PDA

View Full Version : How to return json from php with ajax call



davisty
29 Jan 2015, 9:50 AM
Hello,

Im totally new to PHP. How do I return the json generated from the ajax call.

Ive seen numerous examples, but they only show tables and such being generated in while loops with echo statements. How do I return the entire json response back to the Ext.ajax in one chunk?

I used to code on the AS/400 and it had another way of doing it.

Sorry to ask such a simple question, but Im not familiar enough with PHP yet?

Thank You

Jad
30 Jan 2015, 2:05 AM
hello



header('Content-Type: application/json');
die('{
"success": true,
"total": ????,
"records": ' . json_encode($records) . ', ' . '
"msg": "' . $msg . '"
}');