I’ve got a simple $.ajax request that I am trying to fetch some HTML content with in my ASP.Net MVC app.
// Load the claim table
function GetClaimTable() {
$.ajax({
type: "GET",
url: "claimtable",
data: {},
datafilter: null,
dataType:'text',
success: function(msg){
alert(msg);
$("#claimTable").html(msg.responseText);
},
error: function(msg, sdf, sdd) {
alert(sdf);
alert(sdd);
}
});
But I am getting a parseerror instead. The call is successful because I see 200 OK in firefox and the error has XmlHttpRequest object which has the correct data in the responseText property.
The code works well in IE but fails in firefox. The url claimtable is a simple MVC Action.
I read here jQuery / ASP MVC — parsererror in "$.ajax" calls that this is due to a typo which was solved in jquery 1.3.2. But I have 1.3.2 and I am getting this error.
Any help?
I finally found out why this was happening. The reason was ajaxSetup that I had written to process my jQuery webservice requests more smoothly. Apparently something was wrong even though I was overriding the settings in my new function and the parsererror occurred. I deleted ajaxSetup and now things are working well.
This was the function that destroyed 3 hours of my life.
Looks pretty innocent. eh?