Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/280.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
Javascript jQuery语法错误:意外标记<;_Javascript_Php_Jquery - Fatal编程技术网

Javascript jQuery语法错误:意外标记<;

Javascript jQuery语法错误:意外标记<;,javascript,php,jquery,Javascript,Php,Jquery,我得到一个错误: textStatus:parsererror,ErrorSprown:SyntaxError:意外标记显示表单的标记。使用浏览器开发人员工具检查服务器返回的内容。这可能是某种HTML格式的错误。debug.HTML->在您的php文件中,您正在检查$\u GET['request'],但我没有看到从jquery.RewriteRule^API/register index.php?request=register[NC]发送此参数 $(document).ready(funct

我得到一个错误:


textStatus:parsererror,ErrorSprown:SyntaxError:意外标记显示表单的标记。使用浏览器开发人员工具检查服务器返回的内容。这可能是某种HTML格式的错误。debug.HTML->在您的php文件中,您正在检查
$\u GET['request']
,但我没有看到从jquery.RewriteRule^API/register index.php?request=register[NC]发送此参数
$(document).ready(function(){
  $("form#register-form").submit(function() { // loginForm is submitted
    var lastName = $('#last_name').val(); // get last name
    var firstName = $('#first_name').val(); // get first name
    var email = $('#email').val(); // get email
    var username = $('#username_register').val(); // get username
    var password = $('#password_value').val(); // get password
    var againPassword = $('#confirm-password').val(); // get confirm pass

    /*console.log("JSON: {'LN: '" +lastName);
    console.log("'FN: '" +firstName);
    console.log("'EM: '" +email);
    console.log("'US: '" +username);
    console.log("'PA: '" +password);
    console.log("'AP: '" +againPassword +" }");
    */

    if (username && password && lastName && firstName && email && againPassword) { // values are not empty
      $.ajax({
        type: "POST",
        url: "/API/register", // URL
        contentType: "application/json; charset=utf-8",
        dataType: "json",
        data: {
            firstName: firstName,
            lastName: lastName,
            username: username,
            email: email,
            password: password,
            againPassword: againPassword
        },
        // script call was *not* successful
        error: function(XMLHttpRequest, textStatus, errorThrown) { 
          $('div#loginResult').text("responseText: " + XMLHttpRequest.responseText 
            + ", textStatus: " + textStatus 
            + ", errorThrown: " + errorThrown);
          $('div#loginResult').addClass("error");
        },
        success: function(data){
          if (data.error) { // script returned error
            $('div#loginResult').text("data.error: " + data.error);
            $('div#loginResult').addClass("error");
          } // if
          else { // login was successful
            $('form#loginForm').hide();
            $('div#loginResult').text("data.success: " + data.success 
              + ", data.userid: " + data.userid);
            $('div#loginResult').addClass("success");
          } //else
        } // success
      }); // ajax
    } // if
    else {
      $('div#loginResult').text("enter username and password");
      $('div#loginResult').addClass("error");
    } // else
    $('div#loginResult').fadeIn();
    return false;
  });
});
if(isset($_GET['request'])){
  $API = new API;
  $API->request($pdo);
}
class API{
  public $register = 'register.php';
  function request($pdo){
    $data = $_GET['request'];
    $path = 'server/exec/'.$this->$data;
    if($data){
      if(file_exists($path)){
        include $path;
        echo $path.' -> data';
      } elseif(!file_exists($path)){
        return false;
      }
    }
  }
}
<form id="register-form" action="" method="post" role="form" style="display: none;">
  <div class="form-group">
    <input type="text" name="first_name" id="first_name" tabindex="1" class="form-control" placeholder="First Name" value="">
  </div>
  <div class="form-group">
    <input type="text" name="last_name" id="last_name" tabindex="1" class="form-control" placeholder="Last Name" value="">
  </div>
  <div class="form-group">
    <input type="text" name="username_register" id="username_register" tabindex="1" class="form-control" placeholder="Username" value="">
  </div>
  <div class="form-group">
    <input type="email" name="email" id="email" tabindex="1" class="form-control" placeholder="Email Address" value="">
  </div>
  <div class="form-group">
    <input type="password" name="password_value" id="password_value" tabindex="2" class="form-control" placeholder="Password">
  </div>
  <div class="form-group">
    <input type="password" name="confirm-password" id="confirm-password" tabindex="2" class="form-control" placeholder="Confirm Password">
  </div>
  <div class="form-group">
    <div class="row">
      <div class="col-sm-6 col-sm-offset-3">
        <input type="submit" name="register-submit" id="register-submit" tabindex="4" class="form-control btn btn-register" value="Register Now">
      </div>
    </div>
  </div>
</form>
<div id="loginResult"></div>