PDA

View Full Version : Getting request



karthik_dev
4 Aug 2010, 11:26 PM
Hi,

i am passing success like this

{success: true, message: 'Person was deleted successfully.'}

Front end i am getting its success or not but i am not getting the message

This is my front end code:

success:function(response)
{
var obj = Ext.util.JSON.decode(response.responseText);
alert("It worked (details following)!! = "+obj);
}

evant
5 Aug 2010, 12:25 AM
You need to quote your property names:



{"success": true, "message": "Person was deleted successfully."}

karthik_dev
5 Aug 2010, 12:47 AM
Hi evant,

Thank you for your reply. but i am sorry thats not working

$payload=array("success"=> true, "message"=> 'Person was deleted successfully.');

echo "{'success': true, 'message': 'Person was deleted successfully.'}";

I used the above two methods alternatively, but in front end i am getting undefined when i use that response in a alert.

evant
5 Aug 2010, 12:52 AM
Use it with the response I wrote above.

karthik_dev
5 Aug 2010, 1:10 AM
Hi evant,

{"success":true,"message":"Person was deleted successfully."}

i tried like this also but i am getting the same result. Thanks in advance for your reply.

evant
5 Aug 2010, 1:14 AM
I don't know what to tell you, it worked fine for me.

test.json


{"success": true, "message": "Person was deleted successfully."}


JS


Ext.setup({
tabletStartupScreen: 'tablet_startup.png',
phoneStartupScreen: 'phone_startup.png',
icon: 'icon.png',
glossOnIcon: false,

onReady: function() {
Ext.Ajax.request({
url: 'test.json',
success: function(response){
var o = Ext.decode(response.responseText);
console.log(o.success);
}
});
}
});