Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/jquery-ui/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Jquery ui jquery$.post不';I don’我没有按预期工作_Jquery Ui_Postback - Fatal编程技术网

Jquery ui jquery$.post不';I don’我没有按预期工作

Jquery ui jquery$.post不';I don’我没有按预期工作,jquery-ui,postback,Jquery Ui,Postback,为什么post不工作? 这很好用: function validateEmail($element) { var val = $.trim($element.val()); if (!isRequired(val)) { module.showError($element, translate_error_required.replace("%s",

为什么post不工作? 这很好用:

function validateEmail($element) {
    var val = $.trim($element.val());
    if (!isRequired(val)) {
        module.showError($element,
                                 translate_error_required.replace("%s", 
                                      $element.closest("div.fblock")
                                              .find("div.label label")
                                              .text()
                                              .replace("*", "")))
    }
    else {
        if (!isValidEmailAddress(val)) {
            module.showError($element, translate_error_email)
        }
        else {
            if (!checkUserName) {
                module.showError($element, translate_error_usedemail)
            }
            else {
                module.showCompleted($element)
            }
        }
    }
}
这不起作用,可能是因为post不起作用,因为变量
user\u name
没有传递到
checkuser.php

function checkUserName(checkuser){
        var user_name = $("#add-email").val();
                    alert(user_name);
        $.post("checkuser.php", {user_name: checkuser} , function(data){            
            if (data != '' || data != undefined || data != null){                  
                data=='true';
                return true;
            }
        });
    }
这个
checkuser.php
代码工作正常,但我不知道为什么它没有得到
user\u name

<?php include('../connect.php');
      $username=mysql_real_escape_string($_POST['user_name']); 
      $query  = mysql_query("select Email from members limit 1");           

      $numrow=mysql_fetch_array($query); 
      if($numrow['Email']== $username){
           echo 'false'; 
           exit;
      }else{
            echo 'true';
      }
 ?>

如果(!checkUserName)不是函数调用,并且您没有将其传递给变量,则此代码有效。相反,你应该:

if(!checkUserName(val)) { ... }

你能展示你正在使用的HTML吗?谢谢!我忘记了,但是在添加val之后,post变量不会传递和