NS_ERROR_FAILURE with jQuery.ajax()

StuartProgramming Blog

This had me stumped for too long.  When using an .asmx data lookup service that we wrote in house, and calling it from jquery.ajax, Firefox 28 was getting NS_ERROR_FAILURE and there was no data in the result even though Fiddler2 was showing that the request had completed successfully.  Apparently firefox is rejecting the results because of security in the headers.

To correct this, you need to add the following to the web.config on your service:

<system.webServer>
<httpProtocol>
<customHeaders>
<addname="Access-Control-Allow-Origin"value="*"/>
<addname="Access-Control-Allow-Methods"value="GET,PUT,POST,DELETE,OPTIONS"/>
<addname="Access-Control-Allow-Headers"value="Content-Type"/>
</customHeaders>
</httpProtocol>
</system.webServer>

StuartNS_ERROR_FAILURE with jQuery.ajax()