开发者

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

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 pa开发者_运维问答ge 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


I think you need to use JSON data. For example when you click button "edit", you go to edit page. Inside the page we have ID of record. Now we can load JSON data of your object from your php script. And "onPost" if you get error, you can just run reinit function and load again "clean" data for you model.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜