my application goes like this, user fills the form, the if he's not logged in or registered, once the submit button is clicked, a jquery modal box appears which contains registration fields, after the user fills in the modal fields and click register button, this modal closes and inserts the registration details of the new member.
我的应用程序是这样的,用户填写表单,如果他没有登录或注册,单击提交按钮后,会出现一个包含注册字段的jquery模式框,在用户填写模态字段并单击注册按钮后,此模式关闭并插入新成员的注册详细信息。
now the question is, how to refresh the same page, after the modal closes, to make the page show the current user is a registered member ?, I just want to know how to refresh the page underneath,,
现在的问题是,如何刷新同一页面,模态关闭后,使页面显示当前用户是注册会员?,我只是想知道如何刷新下面的页面,
here's what i have at the moment
这就是我现在所拥有的
if(userid == ""){
$( "#dialog:ui-dialog" ).dialog( "destroy" );
$( "#dialog-confirm" ).dialog({
resizable: false,
height: 230,
width: 350,
modal: true,
buttons: {
"Register": function(){
$(this).dialog("close");
$('div#registerpopup').dialog({
resizable: false,
height: 485,
width: 420,
modal: true,
buttons: {
"Register": function(){
var username = $('#username').val();
var password = $('#password').val();
var retypepassword = $('#retypepassword').val();
var emailaddress = $('#emailaddress').val();
var secondaryemailaddress = $('#secondaryemailaddress').val();
var secretquestion = $('#secretquestion').val();
var secretanswer = $('#secretanswer').val();
var reffcode = $('#reffcode').val();
var emailRegEx = /^[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]{2,4}$/i;
if(username == "" || username.length < 1 || username.length > 30 || username.indexOf(' ') != -1){
alert("Username is required\n-should not be less than 1 character\n-should not be more than 30 characters\n-It may also not contain spaces");
return false;
}
if(password.length < 7 || password.indexOf(' ') != -1 ){
alert("Password should not be empty\n-should at least be 7 characters");
return false;
}
if(retypepassword != password){
alert("re-type password should be the same as the password!");
return false;
}
if(emailaddress == "" || emailaddress.search(emailRegEx) == -1){
alert("Email Address is required and should be a valid email address");
return false;
}
if(secondaryemailaddress == "" || secondaryemailaddress.search(emailRegEx) == -1){
alert("Secondary Email address should be the same as the primary email address!");
return false;
}
if(secretquestion == ""){
alert("Secret Question is required!");
return false;
}
if(secretanswer == ""){
alert("Secret Answer is required!");
return false;
}
if(reffcode == ""){
alert("Reference Code is required!");
return false;
}
else {
$.ajax({
type: "POST",
url: "classes/ajax.registerpopup.php",
timeout: 8000,
data: "username="+username+"&password="+password+"&emailaddress="+emailaddress+
"&secondaryemailaddress="+secondaryemailaddress+"&secretquestion="+secretquestion+
"&secretanswer="+secretanswer+"&reffcode="+reffcode,
success: function(){
alert("You are now registered!");
}
});
}
$(this).dialog("close");
}
}
});
},
"Log in": function() {
$(this).dialog("close");
$('div#loginpopup').dialog({
resizable: false,
height: 230,
width: 350,
modal: true
})
}
}
});
return false;
}
2 个解决方案
#1
1
If you want the full page to be refreshed, can't you call
如果您想刷新整页,请不要打电话
window.location = 'pathToCurrentPage'
after the modal closes? This would force the page to refresh.
模态结束后?这会强制页面刷新。
From User Experience point of view it might be better to just update the part of the page that shows a user is logged in
从用户体验的角度来看,最好只更新显示用户登录的页面部分
#2
0
Call this function on the close event of popup:
在弹出窗口的关闭事件中调用此函数:
document.parent.location.reload();
#1
1
If you want the full page to be refreshed, can't you call
如果您想刷新整页,请不要打电话
window.location = 'pathToCurrentPage'
after the modal closes? This would force the page to refresh.
模态结束后?这会强制页面刷新。
From User Experience point of view it might be better to just update the part of the page that shows a user is logged in
从用户体验的角度来看,最好只更新显示用户登录的页面部分
#2
0
Call this function on the close event of popup:
在弹出窗口的关闭事件中调用此函数:
document.parent.location.reload();