framework7
framework7 copied to clipboard
Добавить error handler для методов get, post, getJSON
Error требуется для построения полноценного promise объекта с использованием перечисленных методов.
Сейчас используется такой фикс //niko
// Shrotcuts
(function () {
var methods = ('get post getJSON').split(' ');
function createMethod(method) {
$[method] = function (url, data, success, error) {
return $.ajax({
url: url,
method: method === 'post' ? 'POST' : 'GET',
data: typeof data === 'function' ? undefined : data,
success: typeof data === 'function' ? data : success,
error: typeof data === 'function' ? success : error, //niko
dataType: method === 'getJSON' ? 'json' : undefined
});
};
}
for (var i = 0; i < methods.length; i++) {
createMethod(methods[i]);
}
})();
This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.