Stop jQuery .load response from being cached

前端 未结 14 1882
迷失自我
迷失自我 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:50

    For PHP, add this line to your script which serves the information you want:

    header("cache-control: no-cache");
    

    or, add a unique variable to the query string:

    "/portal/?f=searchBilling&x=" + (new Date()).getTime()
    

提交回复
热议问题