[removed].reload(); not working for Google chrome

后端 未结 7 824
滥情空心
滥情空心 2020-12-18 23:08

I am using AJAX action after getting the response, I want to reload the current page, for which I am using:

 window.location.reload();

It w

相关标签:
7条回答
  • 2020-12-18 23:19

    you can also try

    window.location.href = window.location;
    
    0 讨论(0)
  • 2020-12-18 23:21

    Try:
    parent.window.location.reload();
    This doesn't work in Firefox 17 for me.

    The only other way I know that works in all browsers is to redirect to another blank page and redirect back to the current page.

    0 讨论(0)
  • 2020-12-18 23:33

    Try this:

    window.opener.location.reload(true);
    window.self.close();
    

    This works for me on all major browsers.

    0 讨论(0)
  • 2020-12-18 23:36

    try the below:

    window.location = self.location;
    

    above code does not work for some browsers, you can even try:

    location.reload( true ); 
    
    0 讨论(0)
  • 2020-12-18 23:41

    Not sure why, but in my case i fixed it by wrapping the reload() call in a setTimeout with 100 ms.

    setTimeout(function(){
        window.location.reload();
    },100); 
    
    0 讨论(0)
  • 2020-12-18 23:42

    If you are working with AJAX, you have to do the reload inside the success function.

    $.ajax({
        type: 'POST',
        data: '',
        url: '',
        success: function(data){
            setTimeout(function(){
                window.location.reload();
            },100);
        },
        error: function(){
    }
    
    0 讨论(0)
提交回复
热议问题