我正在尝试使用Jquery验证并调用web服务来验证字段。但是,当我这样做,我得到了Firebug的错误:JSON无效标签
无效标签 {“d”:假}
这里是我的代码,任何人可以帮助?
$("form").validate({
//errorLabelContainer: $("#divErrors"),
rules: {
txtUserName: {
required: true,
minlength: 4,
maxlength: 20,
remote: function() {
var r = {
type: "POST",
url: "/Services/CDServices.asmx/CheckForUniqueUserName",
contentType: "application/json; charset=utf-8",
dataType: "json",
data: "{'strUserName':'" + $('input[name="txtUserName"]').val() + "'}"
}
return r;
}
}
[WebMethod]
[ScriptMethod(ResponseFormat = ResponseFormat.Json)]
public bool CheckForUniqueUserName(string strUserName)
{
return false;
}
什么将是我的例子中返回.d值的正确语法? – user517406 2011-04-05 08:03:41