How to return multiple JSONs?

How to return multiple JSONs?

Hi,

I am using below PHP and jquery to generate json in order to read it using jquery:

PHP:

  1. $mysql_query = $mysql_connection->prepare('CALL sp_get_request_processing_period(:param_request_category)');

  2. $mysql_query->bindParam(':param_request_category', $request_category, PDO::PARAM_STR);
  3. $mysql_query->execute();

  4. while($mysql_row = $mysql_query->fetch())
  5. {
  6. $processing_days[]=array('days'=>$mysql_row['processing_period_in_days']);
  7. }

  8. $mysql_query = $mysql_connection->prepare("CALL sp_populate_request_purpose(:param_request_category)");

  9. $mysql_query->bindParam(':param_request_category', $request_category, PDO::PARAM_STR);
  10. $mysql_query->execute();

  11. while($mysql_row = $mysql_query->fetch())
  12. {
  13. $response[]=array(
  14. 'purpose_id'=>$mysql_row['request_purpose_id'],
  15. 'purpose_title'=>$mysql_row['request_purpose_title']);
  16. }

  17. echo json_encode(array($response, $processing_days));

JQuery:


  1. success: function(response)
  2. {
  3. for (var i = 0; i < response.length; i++)
  4. {

  5. var request_purpose = "<option value='" + response[i].purpose_id + "'>" + response[i].purpose_title + "</option>";
  6. $(request_purpose).appendTo("#cboPurpose").enhanceWithin();
  7. }

  8. $("#cboPurpose").selectmenu("refresh");
  9. $("#lblRequestName").val(response.name);

  10. $("#lblProcessingPeriod").html(response.days + " working day(s) <font color='#FF0000'>after approval</font>");
  11. $("#divPeriodLoading").hide();
  12. $("#divPurposeLoading").hide();

  13. $("#divProcessingPeriod").show();
  14. $("#divPurpose").show();
  15. },

How can I read the second array $processing_days using JQuery?


Thanks,