FalconSSO/FAuth/wwwroot/js/site.js

45 lines
1.2 KiB
JavaScript
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

// Please see documentation at https://docs.microsoft.com/aspnet/core/client-side/bundling-and-minification
// for details on configuring this project to bundle and minify static web assets.
// Write your JavaScript code.
var myJs = {};
myJs.get = function (url, data, success, error) {
$.ajax({
url: url,
type: "get",
data: data,
success: function (d) {
success(d);
},
error: function (d) {
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) {
error(d.status, d.responseJSON.Id, d.responseJSON.Message)
},
});
}
myJs.msg = function (msg) {
alert(msg);
}
//保存用户凭据的键在_layout视图设置
myJs.userKey = "";
//获取登录的用户票据
myJs.getTicket = function () {
return $.cookie(myJs.userKey);
}
//移除用户登录票据
myJs.removeTicket = function () {
$.removeCookie(myJs.userKey);
}