Results 1 to 2 of 2

Thread: How to return json from php with ajax call

  1. #1
    Sencha User davisty's Avatar
    Join Date
    Mar 2010
    Location
    Spanish Fort, Al
    Posts
    285
    Answers
    11
    Vote Rating
    -9
      0  

    Default How to return json from php with ajax call

    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

  2. #2
    Sencha User Jad's Avatar
    Join Date
    Feb 2012
    Location
    annecy france / geneve suisse
    Posts
    130
    Answers
    12
    Vote Rating
    3
      0  

    Default

    hello

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

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •