Chrome displays ajax response when pressing back button

后端 未结 8 2156
闹比i
闹比i 2020-12-07 22:05

I\'ve come across a problem that if I use jQuery\'s Get method to get some content, if I click back, instead of it actually going back one page in the history, it instead sh

8条回答
  •  感动是毒
    2020-12-07 23:06

    Just in case you are using jQuery with History API (or some library like history.js), you should change $.getJSON to $.ajax with cache set to false:

    $.ajax({
        dataType: "json",
        url: url,
        cache: false,
        success: function (json) {...}
    });
    

提交回复
热议问题