tags:

views:

111

answers:

1

I am using the following code for popping up a registration form.

http://yensdesign.com/2008/09/how-to-create-a-stunning-and-smooth-popup-using-jquery/

I created a registration form inside the popup box and when i submit it i am redirected to a new page. I am no longer inside the popup. Please let me know how to avoid going out of the popup box.

I am using php for validation. My file name is register.php. I included this file in popupbox. The code inside register.php has this format.

<?php

// code for validating fields submited in form

?>

<html>
<form action="register.php">
/// fields
</form>
</html>
+1  A: 

You need to post the form using ajax and then update the html in the popup using data in the result.

Have a look at jQuery.post e.g.

// send form testForm using ajax and update popup content
$.post("test.php", $("#testform").serialize(), function(data){
    $("#myPopupContentId").html(data);
}); 

There are also a couple of plugins you can use that will simplify things, take a look at this example for a demo.

Ola Herrdahl