Php ajaxget方法由于错误而返回NaN

Php ajaxget方法由于错误而返回NaN,php,ajax,Php,Ajax,我试图做的是从wordpress(用户订阅过程)的侧栏中获取用户的电子邮件并将其传递到subdomain.domain.com/index.php。php文件只有三个“echo”,如果电子邮件已经存在,则为“subscribe is echood”,如果是新的,则为“success”,最后为“error”。我想知道为什么“NaN”结果会形成php文件 我还尝试在成功功能中提醒“数据”,但成功从不提醒。但php文件运行时会将数据插入数据库,用户也会收到电子邮件。这正是NaN的回答 注意:整个过程在

我试图做的是从wordpress(用户订阅过程)的侧栏中获取用户的电子邮件并将其传递到subdomain.domain.com/index.php。php文件只有三个“echo”,如果电子邮件已经存在,则为“subscribe is echood”,如果是新的,则为“success”,最后为“error”。我想知道为什么“NaN”结果会形成php文件

我还尝试在成功功能中提醒“数据”,但成功从不提醒。但php文件运行时会将数据插入数据库,用户也会收到电子邮件。这正是NaN的回答

注意:整个过程在我的本地主机(WAMP服务器)上工作

我的Ajax代码:

$("#jap_news_sub_button").click(function() {        
    var user_email = $("#jap_news_sub_email").val();
var datastring = "email=" + user_email;
    $('.img_loader').show();
    $.ajax({
        url: "http://subdomain.domain.com/index.php",
        type: "get",
        data: datastring,
        dataType: "text",
        success: function(data) {
          if (data == "success") {
                $('#jap_error').fadeOut(100);
                $('#jap_response').fadeIn(100);
                $('.img_loader').hide();
                $('.jap_news_sub').fadeOut(100);
            } else if (data == "subscribed") {
                $('#jap_error').fadeOut(100);
                $('.jap_news_sub').fadeOut(100);
                $('.img_loader').hide();
                $('#jap_response').html('You are already subscribed.').fadeIn(100);
            } else {
                $('.img_loader').hide();
                $('#jap_error').fadeOut(100);
            }
        },
        error: function(edata) {
            alert(edata.a + edata.b);
        }
    });
    return false;
    }
    else {
    $('#jap_error').fadeIn(100);
});
}))

PHP文件

 include("connect.php");

 $email = $_GET['email'];

 $query = mysql_query("select * from jap_wysija_user where email='$email' and status='1'");

if(mysql_num_rows($query) > 0)

echo 'subscribed';
error:function(xhr,status,error){
而不是
error:function(edata){

错误:-请求失败时要运行的函数

error: function(XMLHttpRequest, textStatus, errorThrown) { 
    alert("Status: " + textStatus + "Error: " + errorThrown); 
}   

Chinnu我尝试了你的方法我现在得到以下错误状态:parsererrorError错误:JQuery1100158450982067734_13847747506860未调用