JavaScript question - how does dataTables generate _=1359101216769

JavaScript question - how does dataTables generate _=1359101216769

afarberafarber Posts: 53Questions: 0Answers: 0
edited January 2013 in General
Hello,

a very low priority, pure curiosity question :-)

How does dataTables generate the random string of numbers to prevent caching, when fetching JSON data:

[quote]
91.209.51.140 - - [25/Jan/2013:09:06:59 +0100] "GET /cards-json.php?id=VK72883921&_=1359101216769 HTTP/1.1" 200 255254
[/quote]

Which JavaScript function is it? I failed to find that spot in the jquery.dataTables.js

Thanks
Alex

Replies

  • allanallan Posts: 63,523Questions: 1Answers: 10,473 Site admin
    It's not a DataTables 'thing' but rather it comes from jQuery. It is an anti-cache parameter to force the browser to not cache the results from the server and thus get new content every time.

    http://api.jquery.com/jQuery.ajax (check the 'cache' option).

    Allan
  • afarberafarber Posts: 53Questions: 0Answers: 0
    Thank you for the info, I've added

    [code]$.ajaxSetup({ cache: false });[/code]

    to my own script now and have the same.
This discussion has been closed.