jQuery-ajaxTransport-XDomainRequest
jQuery-ajaxTransport-XDomainRequest copied to clipboard
IE 8: In case error, Not able to get Error Message
I am using IE 8 and CROSS I am not able to get error message in case any API call fails. I also tried returning JSON results.
Here are complete request and response objects. How to get Error message in this case.
Request
POST http://xxx/Delete/?key=233219f4 Accept: / Origin: http://localhost Accept-Language: en-US,en;q=0.5 Accept-Encoding: gzip, deflate User-Agent: Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.2; WOW64; Trident/4.0; .NET4.0E; .NET4.0C; .NET CLR 3.5.30729; .NET CLR 2.0.50727; .NET CLR 3.0.30729; HPNTDFJS; InfoPath.3) Host: rahul Content-Length: 0 DNT: 1 Connection: Keep-Alive Pragma: no-cache
Response
HTTP/1.1 417 Expectation Failed Cache-Control: no-cache Pragma: no-cache Content-Length: 101 Content-Type: text/plain; charset=utf-8 Expires: -1 Server: Microsoft-IIS/8.0 Access-Control-Allow-Origin: * X-AspNet-Version: 4.0.30319 X-Powered-By: ASP.NET Date: Fri, 21 Aug 2015 12:23:41 GMT
File Delete Operation Failed : Folder not empty
JSON response
HTTP/1.1 417 Expectation Failed Cache-Control: no-cache Pragma: no-cache Content-Length: 86 Content-Type: text/html Expires: -1 Server: Microsoft-IIS/8.0 Access-Control-Allow-Origin: * X-AspNet-Version: 4.0.30319 X-Powered-By: ASP.NET Date: Fri, 21 Aug 2015 12:57:13 GMT
[{ "msg" : "Folder with fileID =233219f4 is not empty " }]
I believe an an error case, the response body will only be treated as text/plain
. Can you see that text when you inspect the jqXHR.responseText
property in your complete
callback?