您好,欢迎来到三六零分类信息网!老站,搜索引擎当天收录,欢迎发信息

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

2025/7/11 23:47:31发布20次查看
$.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 参数是什么
//单击执行ajax请求操作function clicksubmit(sendurl, data, _sucmsg, _errmsg){ $.ajax({ type: post, sucmsg: _sucmsg, // errmsg: _errmsg, // success: function(data, textstatus) { alert(this.type); //////////弹出type alert(this.sucmsg);//弹出未定义,说明jquery.ajax的options不能自定义自己的 } });}
应该是你的参数 _sucmsg 没有传入
晕。真行啊。昨晚不知哪弄错。
该用户其它信息

VIP推荐

免费发布信息,免费发布B2B信息网站平台 - 三六零分类信息网 沪ICP备09012988号-2
企业名录 Product