I recently did some cross-domain javascript using JSONP and ASP.NET MVC.
A specific controller action will only respond to a POST request, this is by design.
In IE8, I see (via Fiddler2) that the answer is correct, and it returns an HTTP 200 response along with JSONP javascript.
In Firefox, Safari, and Chrome, the response is still returned with the corresponding HTTP 200 code and JSONP content, the only difference is that the XmlHttpRequest object used by JQuery sets the status code to 0, and the responseText to delete.
Initially, I thought that this was due to preliminary coverage of COR HTTP (Http Access Control), as a result of which a custom header or a content type other than text / plain will send an additional HTTP request (using OPTIONS) to the server. I can see in Fiddler2 that HTTP 404 responds to an OPTIONS request.The web server is IIS7 (but the production web server will be the IIS6 box). In IIS7, I see the standard OPTIONSVerbHandler specified in the handlers, but I'm not sure if this is actually doing anything (in fact, I can't even find the documentation about OPTIONSVerbHandler anywhere).
To get around this, I modified the JQuery library so as not to set a custom header, and also change the content type in text / plain instead of application / json, and Firefox finally starts to bypass OPTIONS request and just POST.
- ( XmlHttpRequest), Fiddler2 , HTTP 200 .
?