Skip to content

Commit

Permalink
Added a default error handler the ajax call.
Browse files Browse the repository at this point in the history
  • Loading branch information
gasl committed Jul 31, 2013
1 parent e63f17b commit 4d4884b
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions crafity.ajax.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,12 @@

var ajaxCallCount = 0;

/**
*
* @param url
* @param [success] - optional
* @param [error] - optional
*/
crafity.ajax = function (url, success, error) {
// Normalize parameters
var type = "GET", data;
Expand All @@ -14,6 +20,17 @@
url = url.url;
}

if (!success) {
success = function () {
return false;
};
}
if (!error) {
error = function () {
return false;
};
}

function startLoading() {
ajaxCallCount += 1;
$("html").addClass("loading");
Expand Down

0 comments on commit 4d4884b

Please sign in to comment.