Skip to content
Snippets Groups Projects
Commit 02a18513 authored by xamgore's avatar xamgore
Browse files

Add jquery postJSON method

parent 9efcce8b
Branches
Tags
No related merge requests found
......@@ -7,6 +7,9 @@ var SitePath = g_SitePath;
// Далее юзаем глобальные переменные с префиксом "g"
// Common.js
$.postJSON = function (url, data, callback) {
return $.post(url, data, callback, 'json');
};
var Auth = (function () {
var allowRequest = true;
......@@ -19,12 +22,11 @@ var Auth = (function () {
var self = this;
this.onDeprecate();
$.post(URLdir + 'handler/sign/in', {
'login': login,
'password': pass
}, function (data) {
data = $.parseJSON(data);
callback(data.success === true);
$.postJSON(URLdir + 'handler/sign/in', {
'login': login,
'password': pass,
}).done(({ success: isOk }) => {
callback(isOk);
allowRequest = true;
self.onAllow();
......@@ -37,17 +39,15 @@ var Auth = (function () {
}
})();
var Watcher = (function() {
var Watcher = (function () {
var timer = 0;
return function(ms, callback) {
return function (ms, callback) {
clearTimeout(timer);
timer = setTimeout(callback, ms);
};
})();
Element.prototype.hasClass = function (className) {
return new RegExp(' ' + className + ' ').test(' ' + this.className + ' ');
};
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment