diff --git a/resources/assets/src/js/general.js b/resources/assets/src/js/general.js index 71b7bf49..f40cd6ab 100644 --- a/resources/assets/src/js/general.js +++ b/resources/assets/src/js/general.js @@ -2,11 +2,14 @@ * @Author: printempw * @Date: 2016-09-15 10:39:41 * @Last Modified by: printempw -* @Last Modified time: 2016-09-15 10:43:32 +* @Last Modified time: 2016-10-23 11:04:11 */ 'use strict'; +// guesss base url +var base_url = (location.pathname.endsWith('user') || location.pathname.endsWith('admin')) ? "." : ".."; + function logout(with_out_confirm, callback) { if (!with_out_confirm) { swal({ @@ -21,7 +24,7 @@ function logout(with_out_confirm, callback) { type: 'success', html: json.msg }); - window.setTimeout('window.location = "../"', 1000); + window.setTimeout('window.location = "'+base_url+'/"', 1000); }); }); } else { @@ -34,7 +37,7 @@ function logout(with_out_confirm, callback) { function do_logout(callback) { $.ajax({ type: "POST", - url: "../auth/logout", + url: base_url + "/auth/logout", dataType: "json", success: function(json) { if (callback) callback(json);