View Full Version : Ajax request for json always gives me failure while doing a form load

12 Apr 2012, 4:48 AM
I am using ExtJs 4 and trying to load a form depending on some data returned (json structure) that I receive in the format as below:

{"sucess":"true","data":{"pic":" ../../Scripts/ext/resources/themes/images/access/form/checkbox_.gif"}}

My controller action is as below:

public ActionResult GetPicture()
string pic = " ../../Scripts/ext/resources/
var result = new { pic = pic };
return Json(new { sucess = "true", data = result },

Now, for whatever I do, it always goes to failure. It never hits success.

url: '/Home/GetPicture',
method: "GET",
waitMsg: 'Loading',
success: function (form, action) {
var contact = action.result.data;
Ext.Msg.alert("Load Complete", action.result.data);
Ext.getDom('pic').src = contact.pic;
failure: function(form, action) {
Ext.Msg.alert("Load failed", action.result.errorMessage);

Is there something I'm doing wrong somewhere? I checked firebug and I get the json structure above as the response. But it just always hits failure not success.

12 Apr 2012, 6:46 AM
You misspelled 'success' in your JSON return data and the value of the success property should be a boolean, not a String.