I have ShowExpired()
and SessionDestroy()
functions running the same jquery.
Only difference: I have if statement in ShowExpired().
How can we shrink it?
function ShowExpired() {
if (isextend == false) {
$.ajax({
type: "POST",
cache: false,
url: "../../html/frmLogout.aspx/Sessionlogout",
data: "{userid:" + userid + "}",
contentType: 'application/json; charset=utf-8',
dataType: "json",
async: false,
success: function (data, e, jqxhr) {
if (data.d.result) {
window.location.href = '../HTML/frmLogin.aspx';
}
},
error: function (data, e, jqxhr) { alert("logout ERROR=" + data.responseText); }
});
}
}
function SessionDestroy() {
$.ajax({
type: "POST",
cache: false,
url: "../../html/frmLogout.aspx/Sessionlogout",
data: "{userid:" + userid + "}",
contentType: 'application/json; charset=utf-8',
dataType: "json",
async: false,
success: function (data, e, jqxhr) {
if (data.d.result) {
window.location.href = '../HTML/frmLogin.aspx';
}
},
error: function (data, e, jqxhr) { alert("logout ERROR=" + data.responseText); }
});
}