
您可以构建自己的AJAX处理程序,而不使用默认的ajax:
var ns = {};ns.ajax = function(options,callback){ var defaults = { //set the defaults success: function(data){ //hijack the success handler if(check(data)){ //checks callback(data); //if pass, call the callback } } }; $.extend(options,defaults); //merge passed options to defaults return $.ajax(options); //send request}因此
$.ajax,您现在使用的是呼叫而不是;
ns.ajax({options},function(data){ //do whatever you want with the success data});欢迎分享,转载请注明来源:内存溢出
微信扫一扫
支付宝扫一扫
评论列表(0条)