how to send on previous page where a part of html was loaded

Posted by I Like PHP on Stack Overflow See other posts from Stack Overflow or by I Like PHP
Published on 2010-05-31T11:33:13Z Indexed on 2010/05/31 11:42 UTC
Read the original article Hit count: 156

Filed under:

hello all, i m using Jquery ajax post method to edit a form on same page, but if there is some mistake then how do i send user back on that page where data were loaded.

now i describe u what i do?

i have a page manageMovies.php there are list of movie name, now when i click on a name of any movie, then i load editMovie.php on same page now when i do some mistakes( i.e when validations fails) then i want to go back on same page manageMovies.php loaded with editunit.php regarding that movie on the page.

here is my page structure

manageMovies.php

<div id="display"></div>
<div id="movieList">
  <table >
        <tr><td id="mov_10">Apharan</td></tr>
        <tr><td id="mov_11">Gangaajal</td></tr>
        <tr><td id="mov_12">Rajniti</td></tr>
  </table>
</div>
<script type="text/javascript">
 jQuery('td').click(function () {
        jQuery('#movieList').hide(); // hide the  div 'movielist'
        jQuery.post('editMovie.php', {
            idForEdit: jQuery(this).attr('id')
        }, function (data) {
           jQuery("#display").html(data); //display the editMovie.php page on 'display' div
        });
    });
</script>

now when i do some mistakes on editunit.php and go further for post, then i need to go back on same page (manageMovies.php) where editMovie.php is shown on display div and movielist div should be hidden

© Stack Overflow or respective owner

Related posts about jquery-ajax