1. #1
    Sencha User
    Join Date
    Dec 2011
    Posts
    200
    Answers
    11
    Vote Rating
    4
    dedoz is on a distinguished road

      0  

    Default Answered: JSON in ajax request

    Answered: JSON in ajax request


    How to send an ajax request with content type json.

    Using Ext Direct proxy on a store/model then doing store.load
    sends JSON to the server, the request content type is application/json
    Code:
    Request Headers :
        Content-Type:application/json
         Request Payload
        {"action":"acrQuery","method":"Select","data":[{"page":1,"start":0,"limit":25}],"type":"rpc","tid":4}
    how can i archive the same content type using Ext ajax ?
    if i use Ext.Ajax (using the same data params above) sends
    Code:
    Request Headers :
       Content-Type:application/x-www-form-urlencoded; charset=UTF-8
       Form Dataview URL encoded
       {"action":"acrQuery","method":"Select","data":[{"page":1,"start":0,"limit":25}],"type":"rpc","tid":4}
    its using an html form to send the params, which is correct because documentation says so
    but i need to send a request as json (application/json) so i can proceed like i normally do when a store/model sends a request.

    so how can i make an ajax request that will use content-type:application/json not a form? like my stores load do.

  2. Try this:
    Code:
    Ext.Ajax.request({
        ....
        headers: {
            'Content-Type': 'application/json',
            ...
        }
        ....
    });

  3. #2
    Sencha - Community Support Team
    Join Date
    Jan 2012
    Posts
    1,376
    Answers
    346
    Vote Rating
    109
    vietits is a name known to all vietits is a name known to all vietits is a name known to all vietits is a name known to all vietits is a name known to all vietits is a name known to all

      1  

    Default


    Try this:
    Code:
    Ext.Ajax.request({
        ....
        headers: {
            'Content-Type': 'application/json',
            ...
        }
        ....
    });

  4. #3
    Sencha User
    Join Date
    Dec 2011
    Posts
    200
    Answers
    11
    Vote Rating
    4
    dedoz is on a distinguished road

      0  

    Default


    thanks

Thread Participants: 1

film izle

hd film izle

film sitesi

takipci kazanma sitesi

takipci kazanma sitesi

güzel olan herşey

takipci alma sitesi

komik eğlenceli videolar