PDA

View Full Version : server return 200 OK but no content



tycoi2005
4 Mar 2011, 2:34 AM
I have a Store:


a = new Ext.data.Store({
model: 'Location',
proxy: {
headers: {
'Accept-Type': 'application/json',
'Cache-Control': 'no-cache'
},
type: 'ajax',
timeout: 600,
actionMethods: 'POST',
url: 'bwpos.asmx/LocationList',
reader: {type:'json'}
},
autoLoad: true
})

Onserver:


[WebMethod]
[ScriptMethod(ResponseFormat = ResponseFormat.Json)]
public string LocationList()
{
// GEt location

// end get location
//return JavaScriptConvert.SerializeObject(locationList);
//return locationList;
Context.Response.Clear();
Context.Response.ContentType = "application/json";
Context.Response.Write(JavaScriptConvert.SerializeObject(VisualData.locationList));
Context.Response.End();

return "a";

}

when i load data to store from server, 8/10 request success, but 2 others error:
failed:
http://i163.photobucket.com/albums/t314/tycoi2005/failed.jpg
success:
http://i163.photobucket.com/albums/t314/tycoi2005/success.jpg
Please help me!

4 Mar 2011, 10:15 AM
Are returning "a" or an actual serialized json object?

mitchellsimoens
4 Mar 2011, 11:39 AM
Jay is right... first make sure your returned JSON is valid... http://www.jsonlint.com for the validation.

If you still can't figure it out, listen for the exception event on the Store:


new Ext.data.Store({
...
listeners: {
exception: function(proxy, type, action, options, response, arg) {
//console some of these and it can tell you what's going on
}
}
});

Lot of times I have my root set wrong or something and this tells me where I need to look.

tycoi2005
7 Mar 2011, 1:51 AM
Thx jgarcia (http://www.sencha.com/forum/member.php?172-jgarcia-tdg-i.com) and mitch (http://www.sencha.com/forum/member.php?22216-mitchellsimoens),
After fix my webservices, everything is ok :D


[WebMethod]
[ScriptMethod(ResponseFormat = ResponseFormat.Json)]
public ArrayList LocationList()
{
return VisualData.locationList;
}