I am trying to redirect to another page when the "OK" button of my JQuery dialog is clicked. It seems as though the JQuery function can't access the dialog defined by the JavaScript function. Any help would be appreciated! Here's my code:
$('#submitRegistration').bind('click', function() {
$.post('verification/register.php', $('#register').serializeArray(), function(data){
switch (data) {
case "errMod":
showDlg("Your attempt has been recorded. Expect the po-po any day now!");
break;
case "err1":
showDlg("Username Incorrect", "The username must be at least 6 characters long");
break;
case "err2":
showDlg("Password Incorrect", "Password must be at least 8 characters long");
break;
case "err3":
showDlg("Database Offline", "The database is offline. Please try again later.");
break;
case "err4":
showDlg("Not Unique Username", "Username has already been taken. Please choose another one");
break;
case "noerr":
showDlg("Success!", "You have been registered! Click OK to continue");
while($('#message').dialog('isOpen')) {
continue;
}
window.location = 'none.php';
break;
default:
}
});
});
function showDlg(head, contents) {
$('#message').html(contents);
$('#message').dialog({
title: head,
modal: true,
dragable: false,
//resizable: false,
show: 'slide',
hide: 'slide',
buttons: {
'OK': function() { $('#message').dialog('close'); }
}
});
}