vic o vic vic o vic - 6 months ago 24
Javascript Question

Reload parent page

I don't know how possible this is:

I have a page called

index.php
that uses jquery
.load()
to load another page (
page2.php
) into it, in
page2.php
I have a form that uses
$.ajax
to submit the form. Upon successful submission of the form I want to refresh
index.php
and possibly load
page2.php
into the
index.php
.

I have tried all I can and looked around but I still can not get this to work.
Is this possible and if it is, how do i get this to work.

I hope my question is clear enough?

Answer

In your callback function you can just reload the page.

 $.ajax({
        url:"your_script.php",  
        success:function(data) {
          location.reload();
        }
      });
Comments