ExtJS 4 php get request payload

Hi Guys,

I am pretty sure that you will know this one but in case you don’t then this post might help you.

This post is not about how to create a ExtJS grid. Please follow Extjs 4’s documentation for that. This post is about data handling at server side.

While using data writers such as JSON common when you use Ext JS Grid, when you try to update, create a row or cell the data is posted to your PHP script as RAW POST.

Ok may be I am not making any sense at this stage so consider a Grid such as  shown below

 

 

And when I try to change Unit price above as shown below

It will create a request such as shown below

 

Now the Request payload data is not directly available to you as such in $_POST. Instead its a raw post which you can read at server side as shown below

If I use print_r() on my $rawpostdata I get this

In the above code this is main part

  You can also set always_populate_raw_post_data =truein your php.ini file so that the raw post is available to you in global var $HTTP_RAW_POST_DATA. When using

you will need to take care because it does not support enctype=”multipart/form-data”

I hope this helps

Cheers

Comments

  1. Thanks for your article. He helped me a lot when troubleshooting problems with ExtJs and php. Success!

  2. You saved me. I’ve been working on this for 3 days. You are awesome!!!

  3. Devil Soul says

    Hello Sir,
    why i can’t see your post one week earlier ….. 😀 😀 :D. I lost all my energy finding the solution….. but at last i got it.

    Thanks,

    devil Soul

  4. hi, this article saved my day 🙂
    ty.
    there’s a little typo
    insted of
    $rawpostdata = json_decode($postdata);
    it should be
    $rawpostdata = json_decode($rawpostdata);

    • Sander,
      Thanks for pointing that out, I’ve updated the post. Sometimes its not a good idea to type your code directly into your post editor and also may be do not post when you are almost dead after that crazy party 🙂
      Cheers mate!

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.