$.ajaxSetup({ dataFilter: function(response) { if (response.indexOf('loginBox') !== -1) { window.location.href = ctx + '/login'; return ""; } else { return response; } } });