【问题标题】:How to pass two variable in xhttp.open()? ajax如何在 xhttp.open() 中传递两个变量?阿贾克斯
【发布时间】:2017-12-10 05:48:43
【问题描述】:

我试图在 xhttp.open() 中传递两个变量,但在参数列表错误之后我得到了 Uncaught SyntaxError: missing )

function showHint(str,Password)     
{  
  var xhttp;     
  xhttp = new XMLHttpRequest();    
  xhttp.onreadystatechange = function()

 {

    if (this.readyState == 4 && this.status == 200)

    {    
      document.getElementById("demo").innerHTML = this.responseText;    
    }

 };    
  xhttp.open("GET","CheckLogin.php?fname=" +str+ "&password="+ Password, true);     
  xhttp.send();       
}

错误信息:Uncaught SyntaxError: missing ) after argument list

我在传递 1 个变量时没有出错。我只在尝试在 xhttp.open() 中传递两个变量时出错。如何在 xhttp.open() 中传递两个变量?

【问题讨论】:

  • 我已经解决了这个问题,问题是因为我没有将正确的变量传递给函数。功能正确

标签: javascript ajax


【解决方案1】:

我可以从您的代码中看到的一个问题是

       xhttp.open("GET","CheckLogin.php?fname=" +Email+ "&password="+ Password, true);

不确定电子邮件变量在哪里定义?

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2014-06-18
    • 2010-10-11
    • 1970-01-01
    • 1970-01-01
    • 2011-01-31
    • 2018-05-15
    • 2018-07-04
    • 1970-01-01
    相关资源
    最近更新 更多