var
_mm = {
request :
function
(param){
var
_this =
this
;
$.ajax({
type : param.method ||
'get'
,
url : param.url ||
''
,
dataType : param.data ||
'json'
,
data : param.data ||
''
,
success :
function
(res){
if
(0 == res.status){
typeof
param.success ==
'function'
&& param.success(res.data,res.msg);
}
else
(10 == res.status){
_this.doLogin();
}
else
if
(1 ==res.status){
typeof
param.error ==
'function'
&& param.error(res.msg);
}
},
error :
function
(err){
typeof
param ==
'function'
&& param.error(err.statusText);
}
});
},
doLogin :
function
(){
window.location.href =
'./login.html?redirect='
+ encodeURIComponent(window.location.href);
}
};
module.exports = _mm;