Interesting one here. I have an ASP.NET 1.1 project that contains a web service in it. I’m using jQuery’s AJAX functionality to call some services from the client. This is what my code looks like:
$.ajax({
type: "POST",
url: 'foo.asmx/functionName',
data: 'foo1=' + foo1 + '&foo2=' + foo2,
dataType: "xml",
success: function(xml) {
//do something with my xml data
},
error: function(request, error){
//handle my error
}
});
This works great when I run the site from my IDE on localhost. However, when I deploy this site to any other server I get a parsererror error from jQuery. It does not appear to even call my service as I dropped in some code to write a log file to disk and it’s not making it there.
The same exact XML should be returned from both my localhost and the server I deployed to.
Any ideas?
I found the answer to this. After some debugging with Firebug I noticed that the server was throwing back some error HTML. I looked at my server side error logging and the exception was “Request format is unrecognized.”
After a bit of digging around I discovered that the following change to the web.config corrects the error:
Now I am a bit interested in the fact that my localhost does not have that web.config entry and works regardless. If anyone understands that a little better I’d like to know why.
Thanks for all the suggestions.