Results 1 to 3 of 3

Thread: Ext.Ajax.request throwing unexpected token. FRESH EYES NEEDED..!!!

  1. #1
    Sencha User
    Join Date
    Feb 2011
    Posts
    36

    Default Ext.Ajax.request throwing unexpected token. FRESH EYES NEEDED..!!!

    Hello,

    So, i cannot find where i am messing up... I cant see anything wrong and in the process of ruling out pieces of the code i found out that the problem line is: var result = Ext.decode(transport.response.Text);

    Errors out with: "Uncaught SyntaxError: Unexpected token ) - However, after reviewing the code several times, i am still not finding it. Here is my entire function:
    Code:
    function saveData( data )
    {
        Ext.Ajax.request({
            url: './cms/savecategory',
            method: 'POST',
            params: data,
            success: function( transport ){
                var result = Ext.decode(transport.responseText);
                console.log('during success');
                
                if ( result.success === true )
                {
                    Ext.getCmp(data.gridId).store.reload();
                    Ext.Msg.show({
                       tittle: 'Data Saved',
                       msg: 'Data has been saved.',
                       buttons: Ext.Msg.OK,
                       icon: Ext.MessageBox.INFO
                    });
                }
                else
                {
                    Ext.Msg.show({
                       tittle: 'Data Not Saved',
                       msg: result.message,
                       buttons: Ext.Msg.OK,
                       icon: Ext.MessageBox.INFO
                    });
                }
            }
        });
    }
    Thanks for a refreshing look...!

  2. #2
    Sencha Premium User evant's Avatar
    Join Date
    Apr 2007
    Location
    Sydney, Australia
    Posts
    19,258

    Default

    The problem is in decoding the response, you didn't show what the response is.
    Twitter - @evantrimboli
    Former Sencha framework engineer, available for consulting.
    As of 2017-09-22 I am not employed by Sencha, all subsequent posts are my own and do not represent Sencha in any way.

  3. #3
    Sencha User
    Join Date
    Feb 2011
    Posts
    36

    Default

    Thanks, i ll check my response.

Similar Threads

  1. Uncaught SyntaxError: Unexpected token :
    By kathir in forum Sencha Touch 1.x: Discussion
    Replies: 4
    Last Post: 4 Aug 2011, 4:03 AM
  2. Uncaught SyntaxError: Unexpected token
    By jaquin in forum Sencha Touch 1.x: Discussion
    Replies: 6
    Last Post: 3 Feb 2011, 4:48 AM
  3. Replies: 10
    Last Post: 2 Jan 2011, 4:52 PM
  4. add a param to all Ext.Ajax.request (tree, store, normal Ajax.request)
    By aj3423 in forum Ext 3.x: Help & Discussion
    Replies: 2
    Last Post: 26 Jan 2010, 9:18 AM
  5. [SOLVED] Minimum JS files needed for Ext.Ajax.request?
    By borg in forum Ext 2.x: Help & Discussion
    Replies: 11
    Last Post: 20 Nov 2008, 12:52 PM

Posting Permissions

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