大佬教程收集整理的这篇文章主要介绍了jQuery Ajax成功/错误回调没有在IE中触发,大佬教程大佬觉得挺不错的,现在分享给大家,也给大家做个参考。
在我的脚本的顶部:
// override xhr for browser that use XDR if ('XDomainrequest' in window && window.XDomainrequest !== null) { // override default jQuery transport for IE jQuery.ajaxSetTings.xhr = function() { try { return new XDomainrequest(); } catch(E) { console.log('test'); } }; // Maybe a 304 response is causing the callBACks not to fire? // This makes sure I'm getTing 200 jQuery.ajaxSetTings.cache = false; // also,override the support check jQuery.support.cors = true; }
然后我的ajax电话……非常简单.
$.ajax({ url: url,success: success,complete: complete,beforeSend: beforeSend,error: error }); function success(response,textStatus,jqXHR){ console.log('success'); if( typeof fn == 'function'){ fn(response.data); } else { console.log('Invalid callBACk supplied for dataGateway'); } } function error(jqXHR,errorThrown){ console.log("Could not retrieve data from API."); return; } function complete(jqXHR,textStatus){ console.log('complete'); } // This is the only callBACk that gets fired function beforeSend(jqXHR,setTings){ console.log('before send'); }
有人知道如何解决这个问题吗?
以上是大佬教程为你收集整理的jQuery Ajax成功/错误回调没有在IE中触发全部内容,希望文章能够帮你解决jQuery Ajax成功/错误回调没有在IE中触发所遇到的程序开发问题。
如果觉得大佬教程网站内容还不错,欢迎将大佬教程推荐给程序员好友。
本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。