1. #1
    Sencha User
    Join Date
    Feb 2013
    Location
    Sweden
    Posts
    13
    Vote Rating
    0
    Intraday is on a distinguished road

      0  

    Default Answered: Ext.Ajax.requst

    Answered: Ext.Ajax.requst


    Hello,

    From my Ext Js controller I have this function:
    Code:
            Ext.Ajax.request({
                url: 'save.php',
                method: 'POST',
                params: {
                    mode: 'Submit'
                },
                jsonData: '[{text1:test,text2:go,text3:ready}]',
                success: function() {
                    console.log('success');
                },
                failure: function() {
                    console.log('Failure');
                }
            });
    Can you please tell me how to handle the json in the save.php page?
    I want to decoded the json to an array in the php-page.

    Thanks in advance

  2. Hi,

    You need to put the jsondata inside the params like this:

    Code:
            Ext.Ajax.request({
                url: 'save.php',
                method: 'POST',
                params: {
                    mode: 'Submit',
                    jsonData: '[{text1:test,text2:go,text3:ready}]'
                 },
                success: function() {
                    console.log('success');
                },
                failure: function() {
                    console.log('Failure');
                }
            });
    And then in the PHP script try to get $_POST['jsondata']

    Quote Originally Posted by Intraday View Post
    Hello,

    From my Ext Js controller I have this function:
    Code:
            Ext.Ajax.request({
                url: 'save.php',
                method: 'POST',
                params: {
                    mode: 'Submit',
                },
                jsonData: '[{text1:test,text2:go,text3:ready}]', 
                success: function() {
                    console.log('success');
                },
                failure: function() {
                    console.log('Failure');
                }
            });
    Can you please tell me how to handle the json in the save.php page?
    I want to decoded the json to an array in the php-page.

    Thanks in advance

  3. #2
    Sencha User
    Join Date
    Feb 2013
    Location
    Sweden
    Posts
    13
    Vote Rating
    0
    Intraday is on a distinguished road

      0  

    Default


    Please help me. Anyone?

  4. #3
    Sencha User
    Join Date
    Dec 2007
    Posts
    118
    Answers
    1
    Vote Rating
    12
    corvonero will become famous soon enough

      1  

    Default


    Well, first of all, jsonData is deprecated, so I think you shall not use it.

    Second, the "params" parameter is where you set the parameters you want to send to the server.

    In PHP, you will find them as $_POST['mode'] = "Submit"

  5. #4
    Sencha User
    Join Date
    Mar 2013
    Posts
    3
    Answers
    1
    Vote Rating
    1
    gaquaytomsk is on a distinguished road

      1  

    Default


    Hi,

    You need to put the jsondata inside the params like this:

    Code:
            Ext.Ajax.request({
                url: 'save.php',
                method: 'POST',
                params: {
                    mode: 'Submit',
                    jsonData: '[{text1:test,text2:go,text3:ready}]'
                 },
                success: function() {
                    console.log('success');
                },
                failure: function() {
                    console.log('Failure');
                }
            });
    And then in the PHP script try to get $_POST['jsondata']

    Quote Originally Posted by Intraday View Post
    Hello,

    From my Ext Js controller I have this function:
    Code:
            Ext.Ajax.request({
                url: 'save.php',
                method: 'POST',
                params: {
                    mode: 'Submit',
                },
                jsonData: '[{text1:test,text2:go,text3:ready}]', 
                success: function() {
                    console.log('success');
                },
                failure: function() {
                    console.log('Failure');
                }
            });
    Can you please tell me how to handle the json in the save.php page?
    I want to decoded the json to an array in the php-page.

    Thanks in advance

  6. #5
    Sencha User
    Join Date
    Feb 2013
    Location
    Sweden
    Posts
    13
    Vote Rating
    0
    Intraday is on a distinguished road

      0  

    Default


    Thanks alot!

Thread Participants: 2

Tags for this Thread