$("#logot_name").click(function(){
var current_user="pranav";
alert(current_user);//alert works
var Login = Parse.Object.extend("Login");
var query = new Parse.Query("Login");
query.equalTo("username",current_user);
query.descending("logintime");
query.first({
success: function(object) {
alert(123);//no alert
var d=$.now();
object.set("logouttime",d);
object.save();
},
error: function(object, error) {
alert('Failed to create new object, with error code: ' + error.message);//no error
}
});
alert(1234);//alert works
Parse.User.logOut();
$.session.set("Name"," ")
$.session.set("id"," ")
window.location.replace("index.html");
});
上面的更新对象语句不起作用。我把它放在document.ready中,用户也成功注销。但查询没有执行也没有显示错误信息。不知怎的,查询stmt被忽略了。为什么?
答案 0 :(得分:1)
您需要删除引用以引用您的var:
替换
var query = new Parse.Query("Login");
通过
var query = new Parse.Query(Login);