检查电子邮件时JQuery getJSON()不工作

检查电子邮件时JQuery getJSON()不工作,jquery,asp.net,Jquery,Asp.net,我有一个注册页面,它检查另一个webmethod,看看数据库中是否存在特定的值 对于电子邮件验证,我有 //Checks the email against the database. $(emailTextbox).blur(function () { if ($(this).val()) { email = encodeURI(escape($(this).val())); alert(email); $.getJSON('/Check

我有一个注册页面,它检查另一个webmethod,看看数据库中是否存在特定的值

对于电子邮件验证,我有

//Checks the email against the database.
$(emailTextbox).blur(function () {
    if ($(this).val()) {
        email = encodeURI(escape($(this).val()));
        alert(email);
        $.getJSON('/CheckAvailable.aspx?' + email + ".email", function (results) {
            if (results.email == "true") {
                availabilityEmail.html('<img src="/App_Themes/DefaultTheme/misc/tick.png"/>');
                email = true;
                CheckValid();
            } else {
                availabilityEmail.html('<img src="/App_Themes/DefaultTheme/misc/cross.png"/>');
                email = false;
                CheckValid();
            }
        });
    }
});
但是当我使用
时,似乎
JQuery
方法从未发布过。我甚至试着用
\\.
来逃避它,但它仍然不起作用

有人能帮忙吗

编辑:

使用或不使用encodeURI没有区别。尝试将字符串转换为值也会得到相同的结果。

调试您的应用程序,并将返回的JSON结果粘贴到JSON验证器中,如。从外观上看,您的JSON缺少逗号


查看更多关于JSON的信息。

我使用的是来自其他验证(用户名、昵称等)的复制+粘贴版本。我已经解析了JSON,它工作正常。它来自JQuery->Server,而不是Server->JQuery我对JQuery不在行,但是我可以问一下你为什么需要.email吗?你能不能不使用
$.getJSON(“/CheckAvailable.aspx/GetEmail?”+email
我可以,尽管这只是另一种打球的方式。不会有什么不同。:(祝你好运,对不起,我帮不了什么忙:)太酷了!我觉得很明显有什么东西在等着打我的脸:/但还是查看了你的网站:)很高兴看到另一个南非人有一些好的意见:P
private string GetEmail(string email)
{
    const string strSql =
        "SELECT memberEmail FROM someView WHERE memberEmail = @email";

    var sqlComm = new SqlCommand(strSql, DataConn.Connect()) { CommandType = CommandType.Text };
    sqlComm.Parameters.Add(new SqlParameter("@email", SqlDbType.VarChar, 255)).Value = email;

    string rdr = (string)sqlComm.ExecuteScalar();

    return !string.IsNullOrEmpty(rdr) ? "\"" + "email" + "\"" + " : " + "\"" + "false" + "\"" : "\"" + "email" + "\"" + " : " + "\"" + "true" + "\"" + "\n";
}