[英]Unable to search for user using parse.com query and javascript SDK
Using parse.com and the JavaScript SDK, I want to create a query that checks if a user is already existing. 我想使用parse.com和JavaScript SDK,创建一个查询来检查用户是否已经存在。
There is example code here, which I've adopted and turned into the below code block. 这里有示例代码,我已经采用并变成了下面的代码块。 I'm getting an Uncaught ReferenceError: username is not defined
error, which I don't understand why? 我收到了Uncaught ReferenceError: username is not defined
错误,我不明白为什么?
https://www.parse.com/docs/js_guide#users https://www.parse.com/docs/js_guide#users
var friendFinder = Parse.Object.extend("_User");
var query = new Parse.Query(Parse.User);
query.equalTo(username, "d"); // find users that match
query.find({
success: function (friend) {
if (friendName.length) {
console.log("Success")
}
},
error: function (error) {
//Show if no user was found to match
}
});
You forgot quotes on the "username" field: 您忘记了“用户名”字段上的引号:
var friendFinder = Parse.Object.extend("_User");
var query = new Parse.Query(Parse.User);
query.equalTo("username", "d"); // find users that match
query.find({
success: function (friend) {
if (friendName.length) {
console.log("Success")
}
},
error: function (error) {
//Show if no user was found to match
}
});
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.