创建记录后,用户将被重定向到内部页面。
"redirect to home.html"
我试过了,在“成功”下添加代码,但没有成功:(如何在注册或登录后重定向?
window.location.href = "http://stackoverflow.com";
上面的代码仅在按F5键后才有效
<script type="text/javascript">
Parse.initialize("UWkFSQ1DY.......", "mgI77........");
var Post = Parse.Object.extend("Post");
$("#signup").submit(function(event){
event.preventDefault();
var username = $("#signup-username").val();
var pass = $("#signup-password").val();
var email = $("#signup-email").val();
var user = new Parse.User();
user.set("username", username);
user.set("password", pass);
user.set("email", email);
user.signUp(null, {
sucess: function(user){
window.location.href = "http://stackoverflow.com";
}, error: function(user, error){
console.log("signup error:"+error.message);
}
});
});
</script>
您可以先更改sucess
为,success
然后尝试window.location = "http://www.yoururl.com";
或window.location.href = "whatever"
或window.location.replace("http://www.yoururl.com/");
那么,您可以为其添加回报。如果仍然无法使用?尝试使用setTimeout。
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句