Stop jQuery .load response from being cached

前端 未结 14 1905
迷失自我
迷失自我 2020-11-22 03:54

I have the following code making a GET request on a URL:

$(\'#searchButton\').click(function() {
    $(\'#inquiry\').load(\'/portal/?f=searchBilling&pid=         


        
14条回答
  •  悲哀的现实
    2020-11-22 04:47

    You have to use a more complex function like $.ajax() if you want to control caching on a per-request basis. Or, if you just want to turn it off for everything, put this at the top of your script:

    $.ajaxSetup ({
        // Disable caching of AJAX responses
        cache: false
    });
    

提交回复
热议问题