当前位置: 代码迷 >> PHP >> $.ajax为何自定义的options无法传进去给回调?
  详细解决方案

$.ajax为何自定义的options无法传进去给回调?

热度:53   发布时间:2016-04-28 17:45:58.0
$.ajax为什么自定义的options无法传进去给回调????
本帖最后由 jianye112 于 2015-03-09 23:53:25 编辑
$.ajax为什么自定义的options无法传进去给回调????

//单击执行AJAX请求操作
function clickSubmit(sendUrl, data, _sucmsg, _errmsg){
$.ajax({
type: "POST",
url: sendUrl,
dataType: "json",
timeout: 20000,
data: data,
sucmsg: _sucmsg, //????????????????????????
errmsg: _errmsg,          //????????????????????????
success: function(data, textStatus) {
if (data.status == 1){
$.dialog.tips(this.sucmsg ? this.sucmsg : data.msg, 2, "32X32/succ.png", function(){
//location.reload();
    });
} else {
$.dialog.alert(this.errmsg ? this.errmsg : data.msg);
}
},
error: function (XMLHttpRequest, textStatus, errorThrown) {
$.dialog.alert("状态:" + textStatus + ";出错提示:" + errorThrown);
}
});
}

------解决思路----------------------
可以的!
你看看回调函数的 data 参数是什么
  相关解决方案