简体   繁体   中英

how to reload current page in jquery mobile and trigger some event?

I have the following code:

$(document).on("click", '.logout_button', function(event, ui) {

    $.ajax({
        url: site_url + '/users/logout/',
        type:'POST',
        dataType:'json',
        error:function(data) {
            if (data.status == 200) {
                user = undefined;

                $.mobile.changePage("#categories_page", {
                    allowSamePageTransition: true,
                    transition: 'none',
                    reloadPage: true
                });

            }

        }

    });
});

I try to reload the current page when the user clicks the logout button, and I need the page to be reinitialized so that its content (which is genereated in document-ready) will be regenerated.

I haven't found any way to do this.

The $.mobile.changePage I currently have just reloads the page without triggering any event I know of.

Any idea?

$(document).on("click", '.logout_button', function(event, ui) {

  $.ajax({
    url: site_url + '/users/logout/',
    type:'POST',
    dataType:'json',
    error:function(data) {
        if (data.status == 200) {
            user = undefined;
            $('#categories_page').trigger('pagecreate');
        }
    }
  });
});

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