diff --git a/js/db_search.js b/js/db_search.js
index d78729088d..4cb1396cc0 100644
--- a/js/db_search.js
+++ b/js/db_search.js
@@ -95,14 +95,6 @@ function deleteResult(result_path, msg, ajaxEnable)
}
$(document).ready(function() {
- /**
- * Set a parameter for all Ajax queries made on this page.
- * Don't let the web server serve cached pages
- */
- $.ajaxSetup({
- cache: 'false'
- });
-
/** Hide the table link in the initial search result */
var icon = PMA_getImage('s_tbl.png', '', {'id': 'table-image'}).toString();
$("#table-info").prepend(icon).hide();
diff --git a/js/functions.js b/js/functions.js
index 82d238a60b..c9574a1e7f 100644
--- a/js/functions.js
+++ b/js/functions.js
@@ -1,6 +1,6 @@
/* vim: set expandtab sw=4 ts=4 sts=4: */
/**
- * general function, usally for data manipulation pages
+ * general function, usually for data manipulation pages
*
*/
@@ -43,6 +43,19 @@ function getWindowSize(wnd) {
};
}
+/**
+ * Make sure that ajax requests will not be cached
+ * by appending a random variable to their parameters
+ */
+$.ajaxPrefilter(function (options, originalOptions, jqXHR) {
+ var nocache = new Date().getTime() + "" + Math.floor(Math.random() * 1000000);
+ if (typeof options.data == "string") {
+ options.data += "&_nocache=" + nocache;
+ } else if (typeof options.data == "object") {
+ options.data = $.extend(originalOptions.data, {'_nocache':nocache});
+ }
+});
+
/**
* Add a hidden field to the form to indicate that this will be an
* Ajax request (only if this hidden field does not exist)
diff --git a/js/server_privileges.js b/js/server_privileges.js
index db8239d1ba..6d425a6f40 100644
--- a/js/server_privileges.js
+++ b/js/server_privileges.js
@@ -139,17 +139,6 @@ function appendNewUser(new_user_string, new_user_initial, new_user_initial_strin
*/
$(document).ready(function() {
- /** @lends jQuery */
-
- /**
- * Set a parameter for all Ajax queries made on this page. Some queries
- * are affected by cache settings on the server side, and hence, show stale
- * data. Don't let the web server serve cached pages
- */
- $.ajaxSetup({
- cache: 'false'
- });
-
/**
* AJAX event handler for 'Add a New User'
*
diff --git a/js/server_variables.js b/js/server_variables.js
index 3a14c0b972..ef453f02d4 100644
--- a/js/server_variables.js
+++ b/js/server_variables.js
@@ -8,10 +8,6 @@ $(function() {
saveLink = '' + PMA_getImage('b_save.png') + ' ' + PMA_messages['strSave'] + ' ';
cancelLink = '' + PMA_getImage('b_close.png') + ' ' + PMA_messages['strCancel'] + ' ';
- $.ajaxSetup({
- cache:false
- });
-
/* Variable editing */
if (is_superuser) {
$('table.data tbody tr td:nth-child(2)').hover(
diff --git a/js/sql.js b/js/sql.js
index 90ea43a282..dd8a65d9cd 100644
--- a/js/sql.js
+++ b/js/sql.js
@@ -72,15 +72,6 @@ function getFieldName($this_field)
* @memberOf jQuery
*/
$(document).ready(function() {
-
- /**
- * Set a parameter for all Ajax queries made on this page. Don't let the
- * web server serve cached pages
- */
- $.ajaxSetup({
- cache: 'false'
- });
-
/* Hides the bookmarkoptions checkboxes when the bookmark label is empty */
$('input#bkm_label').keyup(function() {
$('input#id_bkm_all_users, input#id_bkm_replace')
diff --git a/js/tbl_select.js b/js/tbl_select.js
index acd8b1f6ff..ac700f0b9a 100644
--- a/js/tbl_select.js
+++ b/js/tbl_select.js
@@ -13,15 +13,6 @@
* Table Search
*/
$(document).ready(function() {
-
- /**
- * Set a parameter for all Ajax queries made on this page. Don't let the
- * web server serve cached pages
- */
- $.ajaxSetup({
- cache: 'false'
- });
-
/**
* Prepare a div containing a link, otherwise it's incorrectly displayed
* after a couple of clicks
diff --git a/js/tbl_zoom_plot.js b/js/tbl_zoom_plot.js
index 521fc843b4..63428d2726 100644
--- a/js/tbl_zoom_plot.js
+++ b/js/tbl_zoom_plot.js
@@ -167,15 +167,6 @@ function includePan(currentChart) {
}
$(document).ready(function() {
-
- /**
- ** Set a parameter for all Ajax queries made on this page. Don't let the
- ** web server serve cached pages
- **/
- $.ajaxSetup({
- cache: 'false'
- });
-
var cursorMode = ($("input[name='mode']:checked").val() == 'edit') ? 'crosshair' : 'pointer';
var currentChart = null;
var currentData = null;