Stop jQuery .load response from being cached

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

    If you want to stick with Jquery's .load() method, add something unique to the URL like a JavaScript timestamp. "+new Date().getTime()". Notice I had to add an "&time=" so it does not alter your pid variable.

    $('#searchButton').click(function() {
    $('#inquiry').load('/portal/?f=searchBilling&pid=' + $('#query').val()+'&time='+new Date().getTime());            
    });
    

提交回复
热议问题