Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/389.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 使用parse注册用户时出现XMLHttpRequestError问题_Javascript_Parsing_Login - Fatal编程技术网

Javascript 使用parse注册用户时出现XMLHttpRequestError问题

Javascript 使用parse注册用户时出现XMLHttpRequestError问题,javascript,parsing,login,Javascript,Parsing,Login,我正在尝试使用Parse.com向用户注册我正在开发的应用程序。然而,在启动函数时,我似乎出现了一个错误 Parse.initialize("APP ID", "JS KEY"); function signUp() { var user = new Parse.User(); // Get user inputs from form. var username = document.login.username.value; var password = d

我正在尝试使用Parse.com向用户注册我正在开发的应用程序。然而,在启动函数时,我似乎出现了一个错误

Parse.initialize("APP ID", "JS KEY");

function signUp() {
    var user = new Parse.User();

    // Get user inputs from form.
    var username = document.login.username.value;
    var password = document.login.password.value;

    user.set("username", username);
    user.set("password", password);
    user.signUp(null, {
        success: function (user) {
            // Hooray! Let them use the app now.
            alert("Success");
        },
        error: function (user, error) {
            // Show the error message somewhere and let the user try again.
            alert("Error: " + error.code + " " + error.message);
        }
    });
};
错误:

Error: 100 XMLHttpRequest failed: {"statusText":"","status":0,"response":"","responseType":"","responseXML":null,"responseText":"","upload":{"ontimeout":null,"onprogress":null,"onloadstart":null,"onloadend":null,"onload":null,"onerror":null,"onabort":null},"withCredentials":false,"readyState":4,"timeout":0,"ontimeout":null,"onprogress":null,"onloadstart":null,"onloadend":null,"onload":null,"onerror":null,"onabort":null}

这里的任何帮助都会很好,我不确定是什么导致了错误。当我不通过表单数据传递表单数据时,它似乎工作正常。谢谢。

我认为您应该使用:

user.setUsername(username);
user.setPassword(password);
此外,还可以结合使用:

Parse.User.signUp(username, password, { ACL: new Parse.ACL() }, {
    success: function (user) {
        // Hooray! Let them use the app now.
        alert("Success");
    },
    error: function (user, error) {
        // Show the error message somewhere and let the user try again.
        alert("Error: " + error.code + " " + error.message);
    }
});