How to return multiple JSONs?
Hi,
I am using below PHP and jquery to generate json in order to read it using jquery:
PHP:
- $mysql_query = $mysql_connection->prepare('CALL sp_get_request_processing_period(:param_request_category)');
-
- $mysql_query->bindParam(':param_request_category', $request_category, PDO::PARAM_STR);
-
- $mysql_query->execute();
-
-
- while($mysql_row = $mysql_query->fetch())
- {
- $processing_days[]=array('days'=>$mysql_row['processing_period_in_days']);
- }
-
-
- $mysql_query = $mysql_connection->prepare("CALL sp_populate_request_purpose(:param_request_category)");
-
- $mysql_query->bindParam(':param_request_category', $request_category, PDO::PARAM_STR);
- $mysql_query->execute();
-
-
- while($mysql_row = $mysql_query->fetch())
- {
- $response[]=array(
- 'purpose_id'=>$mysql_row['request_purpose_id'],
- 'purpose_title'=>$mysql_row['request_purpose_title']);
- }
-
-
- echo json_encode(array($response, $processing_days));
JQuery:
- success: function(response)
- {
- for (var i = 0; i < response.length; i++)
- {
-
- var request_purpose = "<option value='" + response[i].purpose_id + "'>" + response[i].purpose_title + "</option>";
-
- $(request_purpose).appendTo("#cboPurpose").enhanceWithin();
- }
-
-
- $("#cboPurpose").selectmenu("refresh");
-
- $("#lblRequestName").val(response.name);
-
- $("#lblProcessingPeriod").html(response.days + " working day(s) <font color='#FF0000'>after approval</font>");
-
- $("#divPeriodLoading").hide();
- $("#divPurposeLoading").hide();
-
- $("#divProcessingPeriod").show();
- $("#divPurpose").show();
- },
How can I read the second array $processing_days using JQuery?
Thanks,