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

WBOY
Freigeben: 2016-06-23 13:38:47
Original
806 Leute haben es durchsucht

$.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);		}	});}
Nach dem Login kopieren


回复讨论(解决方案)

可以的!
你看看回调函数的 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不能自定义自己的		}	});}
Nach dem Login kopieren




应该是你的参数 _sucmsg 没有传入

晕。真行啊。昨晚不知哪弄错。

Quelle:php.cn
Erklärung dieser Website
Der Inhalt dieses Artikels wird freiwillig von Internetnutzern beigesteuert und das Urheberrecht liegt beim ursprünglichen Autor. Diese Website übernimmt keine entsprechende rechtliche Verantwortung. Wenn Sie Inhalte finden, bei denen der Verdacht eines Plagiats oder einer Rechtsverletzung besteht, wenden Sie sich bitte an admin@php.cn
Beliebte Tutorials
Mehr>
Neueste Downloads
Mehr>
Web-Effekte
Quellcode der Website
Website-Materialien
Frontend-Vorlage
Über uns Haftungsausschluss Sitemap
Chinesische PHP-Website:Online-PHP-Schulung für das Gemeinwohl,Helfen Sie PHP-Lernenden, sich schnell weiterzuentwickeln!