I am using JQuery Ajax to send request to my action class with data: {campaignId: campaignId}
but _=1389258551926
also sent as data.
My ajax request function is:
$('#submit').click(function() {
var campaignId = $('#campaign').val();
alert("Ajax request ; Camp : " + campaignId);
$.ajax({
type: "get",
url: "getCampData",
data: {campaignId: campaignId},
dataType: "json"
}).done(function(data) {
alert("Camp List : " + data.campList);
});
Query String parameters:
campaignId=Test&_=1389258551927
Why this extra parameter sent as data?
This parameter is a timestamp. You can see it's strangely alike what you'd get in the console with
Date.now()
This is done to ensure the URL changes and avoid receiving a cached version of the page.
It's described in the documentation :
cache (default: true, false for dataType 'script' and 'jsonp')
Type: Boolean If set to false, it will force requested pages not to be cached by the browser. Note: Setting cache to false will only work correctly with HEAD and GET requests. It works by appending "_={timestamp}" to the GET parameters. The parameter is not needed for other types of requests, except in IE8 when a POST is made to a URL that has already been requested by a GET.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With