简体   繁体   中英

Reload part of the page Jquery

I have a table with a td that updates when i press a button .pauseDocker

When It's paused I'm reloading the page. Surely there's a smarter way to just refresh just part of the page in this case the table.

$(document).on('click','.pauseDocker' ,function(){
    var buttonClicked = $(this);
    var containerName = $(this).attr('name');

    $.ajax({
        type: 'post',
        url: '/container/pause',
        data: {containerName: containerName},
        success: function () {

            location.reload();
        },
        error: function() {

        }
    });
});

You can get the first parameter of the success callback and this will contain data from the response of your server. Use that to retrieve the changed data and update client side accordingly

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