Why does jQuery.ajax() add a parameter to the url?

后端 未结 2 2078
温柔的废话
温柔的废话 2020-11-29 08:46

I have a data fetching method that uses jQuery.ajax() to fetch xml files.

/*    */data: function() {                                                    


        
相关标签:
2条回答
  • 2020-11-29 09:02

    That is a 'cache-buster' and is ignored.

    The added parameter changes the url just enough to bypass most all caches that are between you and the source.

    If the Url was not modified, it is likely that data would be served from any one of the caches between you and the resource, including your browser, any proxies, and perhaps the server itself.

    You can find a lot of explanations on the net. Here is one.

    0 讨论(0)
  • 2020-11-29 09:16

    it should be ignored.

    Just to make a test, if you are using rails, don't use the javascript_include_tag but pass the JavaScript as

    <script src="/path/for/the/script/script.js" type="text/javascript"></script> 
    

    It won't enable the cache-buster and with that you can see if your problem is where you think that it is.

    0 讨论(0)
提交回复
热议问题