Changeset - 35943bda15b8
[Not reviewed]
default
0 1 0
Mads Kiilerich - 10 years ago 2015-10-08 23:27:41
madski@unity3d.com
js: add failure callback to ajaxGET

Like ajaxPOST.
1 file changed with 8 insertions and 7 deletions:
0 comments (0 inline, 0 general)
kallithea/public/js/base.js
Show inline comments
 
@@ -377,15 +377,16 @@ function asynchtml(url, $target, success
 
        ;
 
};
 

	
 
var ajaxGET = function(url,success) {
 
var ajaxGET = function(url, success, failure) {
 
    if(failure === undefined) {
 
        failure = function(jqXHR, textStatus, errorThrown) {
 
                if (textStatus != "abort")
 
                    alert("Ajax GET error: " + textStatus);
 
            };
 
    }
 
    return $.ajax({url: url, headers: {'X-PARTIAL-XHR': '1'}, cache: false})
 
        .done(success)
 
        .fail(function(jqXHR, textStatus, errorThrown) {
 
                if (textStatus == "abort")
 
                    return;
 
                alert("Ajax GET error: " + textStatus);
 
        })
 
        ;
 
        .fail(failure);
 
};
 

	
 
var ajaxPOST = function(url, postData, success, failure) {
0 comments (0 inline, 0 general)