PDA

View Full Version : Ext.Ajax.request throwing unexpected token. FRESH EYES NEEDED..!!!



romerve
24 Feb 2011, 2:20 PM
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:


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...!

evant
24 Feb 2011, 6:20 PM
The problem is in decoding the response, you didn't show what the response is.

romerve
25 Feb 2011, 7:22 AM
Thanks, i ll check my response.