控制进入错误块。我的代码有什么问题? [英] control is going into error block. What is wrong in my code?

查看:62
本文介绍了控制进入错误块。我的代码有什么问题?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

$ .ajax({

类型:GET,



cache:false,

url:'/ RideRun365 / kit?sport ='

+ b +'& gender ='+'Men'+'& temp ='+ a,

成功:功能(数据){

$(#notify)

.html(

谢谢!我们会通知你有更多的库存到货。);

},

错误:function(){

alert( hii);

}

});

$.ajax({
type : "GET",

cache : false,
url : '/RideRun365/kit?sport='
+ b + '&gender=' + 'Men' + '&temp=' + a,
success : function(data) {
$("#notify")
.html(
"Thanks! We will notify you as soon as more inventory has arrived.");
},
error : function() {
alert("hii");
}
});

推荐答案

(#notify)

.html(

谢谢!我们会在更多库存到货后立即通知您。);

},

错误:function(){

alert(hii);

}

};;
("#notify")
.html(
"Thanks! We will notify you as soon as more inventory has arrived.");
},
error : function() {
alert("hii");
}
});


您需要更改错误函数的签名以捕获传入的参数。例如,您可以执行以下操作:

You need to change the signature of your error function to capture passed in parameters. For example you could do something like this:
error: function (XMLHttpRequest, textStatus, errorThrown) {
         alert(XMLHttpRequest.statusText);
     }


这篇关于控制进入错误块。我的代码有什么问题?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆