Is CakePhp adding a timestamp to my javascript files requested by ajax?

I am using Pjax to retrieve pages on my cakePhp site. I get an error due to the fact that javascript is retrieved again because it sees it as a new file due to the addition of .js to it? _ = Timestamp.

main.min.js? _ = 1425763395728

If the page is requested using ajax, does cakePhp add this? I can’t think of any other reason why he is returning with a timestamp.

I am using CakePhp 2.5

UPDATE:

The problem was jQuery and this helped remove the timestamp.

$.ajaxPrefilter(function( options, originalOptions, jqXHR ) {
  if ( options.dataType == 'script' || originalOptions.dataType == 'script' ) {
      options.cache = true;
  }
});
+4
source share
2 answers

, Asset.timestamp config var 'force' true. false . : http://book.cakephp.org/2.0/en/development/configuration.html

, JavaScript CSS , .

OP, , CakePHP. , , JavaScript, CakePHP PHP, , .

+3

, OP , - Asset.timestamp CakePHP, jquery ajax, ( OP) ajax-:

//Cache Ajax request script files
$.ajaxPrefilter(function( options, originalOptions, jqXHR ) {
  if ( options.dataType == 'script' || originalOptions.dataType == 'script' ) {
      options.cache = true;
  }
});

//Cache all Ajax request related files
$.ajaxPrefilter(function( options, originalOptions, jqXHR ) {
      options.cache = true;
});

, , , , . Keith!

0

All Articles