fix error when no error handling function was defined
This commit is contained in:
@ -48,16 +48,14 @@ window.digits = function(d) {
|
|||||||
// error: see above. Additionally it is logged if the request failed.
|
// error: see above. Additionally it is logged if the request failed.
|
||||||
window.postAjax = function(action, data, success, error) {
|
window.postAjax = function(action, data, success, error) {
|
||||||
data = JSON.stringify($.extend({method: 'dashboard.'+action}, data));
|
data = JSON.stringify($.extend({method: 'dashboard.'+action}, data));
|
||||||
|
var errCnt = function(jqXHR) { window.failedRequestCount++; window.requests.remove(jqXHR); };
|
||||||
return $.ajax({
|
return $.ajax({
|
||||||
url: 'rpc/dashboard.'+action,
|
url: 'rpc/dashboard.'+action,
|
||||||
type: 'POST',
|
type: 'POST',
|
||||||
data: data,
|
data: data,
|
||||||
dataType: 'json',
|
dataType: 'json',
|
||||||
success: success,
|
success: success,
|
||||||
error: [
|
error: error ? [errCnt, error] : errCnt,
|
||||||
function(jqXHR) { window.failedRequestCount++; window.requests.remove(jqXHR); },
|
|
||||||
error || null
|
|
||||||
],
|
|
||||||
contentType: 'application/json; charset=utf-8',
|
contentType: 'application/json; charset=utf-8',
|
||||||
beforeSend: function(req) {
|
beforeSend: function(req) {
|
||||||
req.setRequestHeader('X-CSRFToken', readCookie('csrftoken'));
|
req.setRequestHeader('X-CSRFToken', readCookie('csrftoken'));
|
||||||
|
Reference in New Issue
Block a user