Jump to content

How to load a jquery popup in successful completion of form


davelearning

Recommended Posts

Hi all,

 

I have the below script which uses jquery to display a modalbox when I link is clicked on, which works fine!

<script>
$(document).ready(function() 
{	
$('a[name=modal]').click(function(e) 
	{
		e.preventDefault();
		var id = $(this).attr('href');
		var maskHeight = $(document).height();
		var maskWidth = $(window).width();
		$('#mask').css({'width':maskWidth,'height':maskHeight});
		$('#mask').fadeIn(1000);	
		$('#mask').fadeTo("slow",0.;	
		var winH = $(window).height();
		var winW = $(window).width();
		$(id).css('top',  winH/2-$(id).height()/2);
		$(id).css('left', winW/2-$(id).width()/2);
		$(id).fadeIn(2000); 
	});

$('.window .close').click(function (e) 
{
	e.preventDefault();
	$('#mask').hide();
	$('.window').hide();

});		

$('#mask').click(function ()
 {
	$(this).hide();
	$('.window').hide();
});			
});
</script>

 

However what I would like to do is have a modal box popup when a user registers, basically they will be redirected to the index page, where they should have this popup come up, just with a message telling them that their registration was succesful blah blah.

 

The script is currently called by doing this:

<a href="#dialog"  name="modal">Login</a>

 

Where the div id dialog contains the data to be loaded into the popup.

 

How would I do this?

 

Thanks

 

 

Link to comment
Share on other sites

Hi Thorpe, yup, just realised that I hadn't included the .css file, that leads to the rest of my code working again, however nothing pops up when I refresh the page/

<script>
$(function() {
	$( "#dialog" ).dialog();
});
</script>

 

and

<div id="dialog">Popup test</div>

 

Got it now!

<script>
$(function() {
	$( "#dialog" ).dialog();
modal: true
});
</script>

 

 

 

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.