我正在嘗試使用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