1

I am using Rails 4 and unobstrusive javascript(UJS) to make a ajax call:

I'd like to disable the caching so that if somebody clicks the same link again and that the content in databse has changed, a new content will load inside the modal.

I want to use UJS and not vanilla javascript or metas.

Some people do:

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

How to write this with Rails?

<%= link_to "view", show_opportunities_path, remote: true, cache: false %> does not work.
Community
  • 1
  • 1
Mathieu
  • 4,587
  • 11
  • 57
  • 112
  • possible duplicate of [Using tags to turn off caching in all browsers?](http://stackoverflow.com/questions/1341089/using-meta-tags-to-turn-off-caching-in-all-browsers) – dimakura Sep 25 '15 at 17:44
  • could you be more explicit/ give more details because I don't use anywhere http-equiv="Cache-Control". I'mm asking a question very specific to Rails. – Mathieu Sep 25 '15 at 17:53
  • and I don't want to disable caching on all browser, nor on all my reqetss, just on ONE specific modal – Mathieu Sep 25 '15 at 17:54
  • if unobtrusive javascript uses jQuery ajax then what `some people do` will work fine – charlietfl Sep 25 '15 at 18:06
  • @charlietfl true if it enables me disable caching on one specific MODAL and not all files/pages/modals – Mathieu Sep 25 '15 at 18:19

0 Answers0