简体   繁体   中英

Creating a Back Button, to go to the previous page in a jquery dialog box

I have a jquery dialog box, which opens up and has main user view, which is mainly a list of clients, and a selection of buttons, from which the user can either edit the clients details, delete the client, or add some information to the client. when the user clicks edit client, it takes the user to the edit client form, which is loaded in the same dialog box, here is the jquery markup for what happens after the edit button is clicked:

$(".editClient").button({icons: {primary: "ui-icon-pencil"}, text: false}).width("28px").height("20px").click(function() {

                   $.ajax({
                   dataType: "html",
                   url: "ajax.php?action=edit_client_form",
                   beforeSend: function()
                   {
                    $('.error, .success, .notice').remove();

                   },
                   success: function(html)
                   {

                    $('#users-contain').html(html);

                   }

                 });
            });

as you can see it currently loads the information from the ajax page, here is the markup for the edit_client_form section:

        $html .= '<table>
                <tr>
                 <td><button class="backForm" type="button">Back</button></td>
                </tr>
              </table>';


echo $html;

What I need is a back button, which takes the user back to the main view from the edit form, does anyone have any ideas on how I would do this?

Maybe this will help, it's attached to the document so the link / button can be loaded in at any point

$(function(){

    $(document).on('click', 'button.backForm', function(){

        history.go(-1);

    });

});

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM