I have such problem: I’m using rails, devise gem and jQuery validation plugin. I have after registration path, but I need to call modal with congrats message. So when I call submit – it is calling, but within a second it is closed, because of redirection to other page.
I need to call modal AFTER redirection, how I can do this ?
Here is my js code :
EDITED: How to make it works? Calling modal if notice=…
$(document).ready(function(){
if($('.notice').val() == 'Welcome! You have signed up successfully.')
$('#congrats').show();
$('.sign_up').validate({
rules: {
"user[email]":{
email: true,
required: true
},
"user[first_name]":{
required: true
},
"user[last_name]":{
required: true
},
'user[password]': {
required: true,
minlength: 6
},
'user[password_confirmation]': {
required: false,
}
},
success: "valid"
});
$(".sub a").click(function() {
$(this).siblings("div").show("fast");
});//code for showing hidden areas
HTML code of alert:
<div class="alert alert-notice">Signed out successfully.</div>
On submitting/validating the form just open the dialog box like
$('#congrats').show();return false;
and on close of the dialog box just do
form.submit();