$.jyAjax = function (options){
options.async = (options.async==null || typeof(options.async)=="undefined")? "true" : options.async;
options.type = (options.type==null || typeof(options.type)=="undefined")? "POST" : options.type;
options.data = (options.data==null || options.data=="" || typeof(options.data)=="undefined")? {"date": new Date().getTime()} : options.data;
options.data["token"] = $.cookie("token");
$.ajax({
url:options.url,
data:options.data,
async:options.async,
type:options.type,
dataType:"json",
beforeSend: function(){
},
success:function(data){
alert("请求成功");
options.success(data);
},
error:function(data){
alert("请求失败");
},
complete: function(){
}
})
}
$.jyAjax({
url:apiUrl+"cmsLogin/login.do",
data:{'yhm':username,'mm':$.md5(userpwd),'yzm':yzm},
type:'POST',
success:function(result) {
if(result.state == 0){
//alert(result.state);
$.cookie("token", result.data.token);
window.location.href = cmsUrl+"main/index.htm";
}else{
alert(result.msg);
}
}
});