Error handling cross domain jquery ajax call

后端 未结 2 1700
甜味超标
甜味超标 2020-12-19 19:46

I am performing one cross domain get operation as shown below.

$.ajax({
    type: \"GET\",
    url: \"http://localhost:65249/api/item/get\",
    data: {
            


        
2条回答
  •  借酒劲吻你
    2020-12-19 20:09

    Unfortunately, if you are using JSONP, all requests that return an error fail silently. This is because JSONP uses a script tag instead of XmlHttpRequest. If you want errors to fire, you need to use XHR with CORS. CORS needs to be configured on the server side, and it works client side only in IE 10+.

提交回复
热议问题