Ajax receives request with useless parameter

I am trying to do the following:

$.ajax({
type: 'GET',
url: 'http://127.0.0.1:6789/dir', 
data: "",   
success: function(data) { /*do something*/ },
dataType: 'html'
});

But when it is running, my server gets something like below:

http://127.0.0.1:6789/dir?_32567871112

I do not want to pass any parameters. What am I wrong?

0
source share
3 answers

In short, set cacheto truein your call options $.ajax.

jQuery adds that to split the cache.

In jQuery there is an option to disable this: (from http://api.jquery.com/jQuery.ajax/ )

cache

The default true, falsefor dataType 'script' and 'jsonp'

false, . false , "_ = [TIMESTAMP]", URL.

cache true:

$.ajax({
  type: 'GET',
  cache: true,
  url: 'http://127.0.0.1:6789/dir',
  data: "",
  success: function (data) { /*do something*/
  },
  dataType: 'html'
});
+1

jQuery.ajax

, , . , true POST ( , )

+1

ajaxSetup:

$.ajaxSetup({ cache: false });

, ! .

+1

All Articles