gpt4 book ai didi

php - GET 请求错误,Uncaught SyntaxError : Unexpected identifier OPTIONS

转载 作者:塔克拉玛干 更新时间:2023-11-01 19:10:44 30 4
gpt4 key购买 nike

我在发送 get 请求时似乎遇到了一个非常奇怪的错误,我同时运行了PHP 和 javascript 代码在同一台服务器上,所以没有来源问题。错误:

Uncaught SyntaxError: Unexpected identifier
OPTIONS http://localhost/Scores.php
Uncaught SyntaxError: Unexpected identifier

在这一行:

        req.send("&name="+username+"&pw="+password);

我的完整代码:

function initiateLoginSequence() {
var isnewplayer=prompt("Hello! Are you new?(Y/N)");
if(isnewplayer == "N") {
var username = prompt("Enter username.");
var password = prompt("Enter Password.");
} else {
var username = prompt("Enter a username. This will be used for future logins.");
var password = prompt("Enter a password. This will be used for future logins.","*");
var req = new XMLHttpRequest();
req.open('GET', 'http://localhost/Scores.php', true);
req.send("&name="+username+"&pw="+password);
}
}

最佳答案

试试这个:

req.open('GET', 'http://69.144.34.106/Scores.php?name='+username+'&pw='+password, true);   
req.send();

关于php - GET 请求错误,Uncaught SyntaxError : Unexpected identifier OPTIONS,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/15164254/

30 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com