jQuery ValidForm ajaxurl 做异步参数校验。jsp返回"ok "但是 输出结果是b 打印s=="ok" s是false,请问这是
if($(this).attr("ajaxurl")){varinputobj=$(this);inputobj.attr("valid",tipmsg.c);$.fn....
if($(this).attr("ajaxurl")){
var inputobj=$(this);
inputobj.attr("valid",tipmsg.c);
$.fn.Validform.sn.showmsg(tipmsg.c,settings.tiptype,{obj:inputobj,type:1,sweep:settings.tipSweep},"hide");
$.ajax({
type: "POST",
url: inputobj.attr("ajaxurl"),
data: "param="+$(this).val()+"&name="+$(this).attr("name"),
dataType: "text",
success: function(s){ alert(s=="ok");
if(rtsult=="ok"){
alert("a");
inputobj.attr("valid","true");
errorobj=null;
$.fn.Validform.sn.showmsg(tipmsg.r,settings.tiptype,{obj:inputobj,type:2,sweep:settings.tipSweep},"hide");
}else{
alert("b");
inputobj.attr("valid",s);
errorobj=inputobj;
$.fn.Validform.sn.showmsg(s,settings.tiptype,{obj:inputobj,sweep:settings.tipSweep});
}
},
高手请指点 一直在线等待 谢谢。 展开
var inputobj=$(this);
inputobj.attr("valid",tipmsg.c);
$.fn.Validform.sn.showmsg(tipmsg.c,settings.tiptype,{obj:inputobj,type:1,sweep:settings.tipSweep},"hide");
$.ajax({
type: "POST",
url: inputobj.attr("ajaxurl"),
data: "param="+$(this).val()+"&name="+$(this).attr("name"),
dataType: "text",
success: function(s){ alert(s=="ok");
if(rtsult=="ok"){
alert("a");
inputobj.attr("valid","true");
errorobj=null;
$.fn.Validform.sn.showmsg(tipmsg.r,settings.tiptype,{obj:inputobj,type:2,sweep:settings.tipSweep},"hide");
}else{
alert("b");
inputobj.attr("valid",s);
errorobj=inputobj;
$.fn.Validform.sn.showmsg(s,settings.tiptype,{obj:inputobj,sweep:settings.tipSweep});
}
},
高手请指点 一直在线等待 谢谢。 展开
1个回答
展开全部
你这代码排版可真够乱的,看半天我都晕了
我有完整的jquery页面参数代码
看看对你有用没,可以追问
var AjaxDeleteLink = "<% =Url.Action("AjaxDelete")%>" + "?time=" + (new Date()).getTime();
$(".ajax_Delete").click(function(){
var did = $(this).attr("title");
var data=$("#contact").val();
$("#deldialog").html(sAskDelete);
$("#deldialog").dialog("option", "buttons",
{ "取消": function() { $(this).dialog("close");},
"确定": function() {
$.ajax({
type:"POST",
url: AjaxDeleteLink,
data: { id: did,PageNum:ToPageNum ,searchStr:ToSearch},
dataType: "text",
beforeSend: function(XMLHttpRequest) {},
success:function(msg){
switch (msg) {
case "Y":
$("#opdialog").html(sSuccessDelete);
$("#opdialog").dialog("option", "buttons",{ "关闭": function() { $(this).dialog("close");}});
$("#opdialog").dialog("open");
$("#ListAjax").load(ReloadLink,{PageNum:ToPageNum,searchStr:ToSearch});
break;
default:
$("#opdialog").html(msg);
$("#opdialog").dialog("option","buttons",{ "关闭": function() { $(this).dialog("close");}});
$("#opdialog").dialog("open");
break;
}
},
error: function() {
$("#opdialog").dialog("option", "buttons",{ "关闭": function() { $(this).dialog("close");}});
$("#opdialog").html(sError);
$("#opdialog").dialog("open");
}
});
$(this).dialog("close");
}});
$("#deldialog").dialog("open");
});
我有完整的jquery页面参数代码
看看对你有用没,可以追问
var AjaxDeleteLink = "<% =Url.Action("AjaxDelete")%>" + "?time=" + (new Date()).getTime();
$(".ajax_Delete").click(function(){
var did = $(this).attr("title");
var data=$("#contact").val();
$("#deldialog").html(sAskDelete);
$("#deldialog").dialog("option", "buttons",
{ "取消": function() { $(this).dialog("close");},
"确定": function() {
$.ajax({
type:"POST",
url: AjaxDeleteLink,
data: { id: did,PageNum:ToPageNum ,searchStr:ToSearch},
dataType: "text",
beforeSend: function(XMLHttpRequest) {},
success:function(msg){
switch (msg) {
case "Y":
$("#opdialog").html(sSuccessDelete);
$("#opdialog").dialog("option", "buttons",{ "关闭": function() { $(this).dialog("close");}});
$("#opdialog").dialog("open");
$("#ListAjax").load(ReloadLink,{PageNum:ToPageNum,searchStr:ToSearch});
break;
default:
$("#opdialog").html(msg);
$("#opdialog").dialog("option","buttons",{ "关闭": function() { $(this).dialog("close");}});
$("#opdialog").dialog("open");
break;
}
},
error: function() {
$("#opdialog").dialog("option", "buttons",{ "关闭": function() { $(this).dialog("close");}});
$("#opdialog").html(sError);
$("#opdialog").dialog("open");
}
});
$(this).dialog("close");
}});
$("#deldialog").dialog("open");
});
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询