var myJs = {} //保存用户凭据的键 myJs.userKey = "_userCookieKey"; //获取登录的用户票据 myJs.getTicket = function () { return $.cookie(myJs.userKey); }; //移除用户登录票据 myJs.removeTicket = function () { $.removeCookie(myJs.userKey); }; myJs.get = function (url, data, success, error) { $.ajax({ url: url, type: "get", data: data, success: function (d) { success(d); }, error: function (d) { if (!error) { error = function (s, i, m) { myJs.msg(m); }; } error(d.status, d.responseJSON.Id, d.responseJSON.Message) }, }); } myJs.post = function (url, data, success, error) { $.ajax({ url: url, type: "post", data: data, success: function (d) { success(d); }, error: function (d) { if (!error) { error = function (s, i, m) { myJs.msg(m); }; } error(d.status, d.responseJSON.Id, d.responseJSON.Message) }, }); } myJs.msg = function (msg) { alert(msg); } myJs.url = { app: { AddNewApp: "api/app/AddNewApp", RemoveApp: "api/app/RemoveApp", GetApps: "api/app/GetApps", GetAppList: "api/app/GetAppList", }, user: { GetUsers: "/api/User/GetUsers", AddNewUser: "/api/User/AddNewUser", RemoveUser: "/api/User/RemoveUser", }, }; var mydata = {}