When the browser page goes back, that is to say, you click the link to go to a page, and then click the back button to return to the previous page. The result Found that jQuery's ajax GET request is no longer executed? ? ?
Disable ajax cache: $.ajaxSetup({ cache: false });
Tucao: In order to solve this problem on the Internet After reading for an hour, almost all the answers are nonsense. Finally found it at https://stackoverflow.com/questions/11508101/how-can-you-force-ajax-content-to-reload-when-a-user-presses-the-back-button-on in a deserted corner got the answer. The answer is just adding a line of code. . . . .
$(document).ready(function(){ $.ajaxSetup({ cache: false }); // 仅添加这一句就可解决问题 $.ajax({ url: '/test_ajax', type: 'GET', dataType: 'json', success: function(data) { // 处理数据…… }, error: function() { } }); });
The above is the detailed content of The browser page goes back, how to re-run ajax. For more information, please follow other related articles on the PHP Chinese website!