summaryrefslogtreecommitdiffstats
path: root/lib/jquery.jtable.js
diff options
context:
space:
mode:
authorhikalkan <hi_kalkan@yahoo.com>2014-03-08 19:35:32 +0200
committerhikalkan <hi_kalkan@yahoo.com>2014-03-08 19:35:32 +0200
commitfc98080883d9285f2ecdba12c9a729c4000f53a0 (patch)
treea498f810f3ab71bace01e141b941487ddfbf8eeb /lib/jquery.jtable.js
parentbc47eca00f84edb1294526e7b468ab1064677a42 (diff)
downloadjtable-fc98080883d9285f2ecdba12c9a729c4000f53a0.zip
jtable-fc98080883d9285f2ecdba12c9a729c4000f53a0.tar.gz
jtable-fc98080883d9285f2ecdba12c9a729c4000f53a0.tar.bz2
jTable v2.4.0
Diffstat (limited to 'lib/jquery.jtable.js')
-rw-r--r--lib/jquery.jtable.js29
1 files changed, 27 insertions, 2 deletions
diff --git a/lib/jquery.jtable.js b/lib/jquery.jtable.js
index 91c21ca..869af24 100644
--- a/lib/jquery.jtable.js
+++ b/lib/jquery.jtable.js
@@ -1,6 +1,6 @@
/*
-jTable 2.4.0a
+jTable 2.4.0
http://www.jtable.org
---------------------------------------------------------------------------
@@ -59,6 +59,7 @@ THE SOFTWARE.
loadingAnimationDelay: 500,
saveUserPreferences: true,
jqueryuiTheme: false,
+ unAuthorizedRequestRedirectUrl: null,
ajaxSettings: {
type: 'POST',
@@ -1155,14 +1156,38 @@ THE SOFTWARE.
});
},
+ _unAuthorizedRequestHandler: function() {
+ if (this.options.unAuthorizedRequestRedirectUrl) {
+ location.href = this.options.unAuthorizedRequestRedirectUrl;
+ } else {
+ location.reload(true);
+ }
+ },
+
/* This method is used to perform AJAX calls in jTable instead of direct
* usage of jQuery.ajax method.
*************************************************************************/
_ajax: function (options) {
- var opts = $.extend({}, this.options.ajaxSettings, options);
+ var self = this;
+
+ //Handlers for HTTP status codes
+ var opts = {
+ statusCode: {
+ 401: function () { //Unauthorized
+ self._unAuthorizedRequestHandler();
+ }
+ }
+ };
+
+ opts = $.extend(opts, this.options.ajaxSettings, options);
//Override success
opts.success = function (data) {
+ //Checking for Authorization error
+ if (data && data.UnAuthorizedRequest == true) {
+ self._unAuthorizedRequestHandler();
+ }
+
if (options.success) {
options.success(data);
}