-
10 Jul 2012 9:15 AM #1
Ajax lways giving me failure
Ajax lways giving me failure
hey guys,
i'm trying to use ajax for the first time with sencha, the problem is that my code always leads to failure and i dont know why cause my code seems to be right.
Code:Ext.Ajax.request({ url : 'contact.php', success : function(response){ var a = response.responseText; alert(a); }, failure: function(response){ Ext.Msg.alert(response.responseText); } });
-
10 Jul 2012 10:32 AM #2
Your request looks ok. Is there something in your php that is failing? Is the data coming back actually json? In what way does it fail? Do you receive any errors?
-
11 Jul 2012 1:19 AM #3
Well my in my php file there's a simple echo "right";
and i got no errors, it's only the alert i did in the failure clause. I don't know what's wrong :S
-
11 Jul 2012 5:39 AM #4
Does the alert actually say the word "right"? Are you sure it is the alert in the failure callback since it is the same thing as the one in the success callback? I can take your alert put it in firebug and have it work if I also create the php contact.php file with an echo "right" in it. Is your contact.php in the right location? There has to be something different or a missing detail.
-
11 Jul 2012 6:30 AM #5
the file contact.php is in the same folder as the script and for failure code it wasnt the same i just chenged to so as i see if there's a diffrence. it was an alert that says wrong... For what I see everything should work correctly but something is not working what is it I don't know!! .. but thank u any way for your time ^^.. i you find something just tell me

-
11 Jul 2012 6:43 AM #6
thanks Tim .. it worked now .. i guess that the app considers that its in the parent folder of the app so I had to change the location from "contact.php" to "app/view/contact.php" and it worked.. Yaay



Reply With Quote