当我使用jquery validator.addmethod,遇到错误,它有什么用途? [英] when i use jquery validator.addmethod, meet error,what's rong with it?

查看:66
本文介绍了当我使用jquery validator.addmethod,遇到错误,它有什么用途?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

jQuery.validator.addMethod(mail,function(value,element){

var f = 0;

jQuery.ajax({

类型:get,

url:Master / chkmail,

async:true,

cache:false,

数据:{mail:function(){return $(#email)。val();}},

dataType:json,

成功:函数(数据){if(data == true){f = 1;} else {f = 0;}

},

错误:function(){alert(arguments [1]);}

})

返回f< 0?false:true;

});



Mastercontroller:

public JsonResult chkmail(string mail)

{

JsonResult result = new JsonResult();

BLL.Member bll = bll = new MvcBBS.BLL.Member();

if(bll.emailExists(mail))

{



result.Data = true;

}

else

{

result.Data = false;

}

返回结果;

}

请帮帮我,非常感谢

jQuery.validator.addMethod("mail", function (value, element) {
var f = 0;
jQuery.ajax({
type: "get",
url: "Master/chkmail",
async: true,
cache: false,
data: { mail: function () { return $("#email").val(); } },
dataType: "json",
success: function (data) { if (data == true) { f = 1; } else { f = 0; }
},
error: function () { alert(arguments[1]); }
})
return f < 0 ? false : true;
});

Mastercontroller:
public JsonResult chkmail(string mail)
{
JsonResult result = new JsonResult();
BLL.Member bll = bll = new MvcBBS.BLL.Member();
if (bll.emailExists(mail))
{

result.Data = true;
}
else
{
result.Data = false;
}
return result;
}
Please help me,thanks a lot

推荐答案

(#email)。val(); },

dataType:json,

成功:函数(数据){if(data == true){f = 1; } else {f = 0; }

},

错误:function(){alert(arguments [1]); }

})

返回f< 0? false:true;

});



Mastercontroller:

public JsonResult chkmail(string mail)

{

JsonResult result = new JsonResult();

BLL.Member bll = bll = new MvcBBS.BLL.Member();

if(bll.emailExists(mail))

{



result.Data = true;

}

else

{

result.Data = false;

}

返回结果;

}

请帮帮我,非常感谢
("#email").val(); } },
dataType: "json",
success: function (data) { if (data == true) { f = 1; } else { f = 0; }
},
error: function () { alert(arguments[1]); }
})
return f < 0 ? false : true;
});

Mastercontroller:
public JsonResult chkmail(string mail)
{
JsonResult result = new JsonResult();
BLL.Member bll = bll = new MvcBBS.BLL.Member();
if (bll.emailExists(mail))
{

result.Data = true;
}
else
{
result.Data = false;
}
return result;
}
Please help me,thanks a lot


数据:{mail:function(){return
data: { mail: function () { return


(#电子邮件)VAL()。 },



这甚至有用吗?为什么不获取价值并将其放入另一行代码中的数据?



您是否在Chrome中调试过?什么行有错误?
("#email").val(); } },

Does this even work ? Why not get the value and put it in to the data in another line of code ?

Have you debugged in Chrome ? What line has the error ?


这篇关于当我使用jquery validator.addmethod,遇到错误,它有什么用途?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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