Show More
@@ -36,18 +36,22 b' var toQueryString = function(o) {' | |||
|
36 | 36 | /** |
|
37 | 37 | * ajax call wrappers |
|
38 | 38 | */ |
|
39 | var ajaxGET = function(url, success) { | |
|
39 | var ajaxGET = function(url, success, failure) { | |
|
40 | 40 | var sUrl = url; |
|
41 | 41 | var request = $.ajax({url: sUrl, headers: {'X-PARTIAL-XHR': true}}) |
|
42 | 42 | .done(function(data){ |
|
43 | 43 | success(data); |
|
44 | 44 | }) |
|
45 | .fail(function(data, textStatus, xhr){ | |
|
46 | alert("error processing request: " + textStatus); | |
|
45 | .fail(function(data, textStatus, xhr) { | |
|
46 | if (failure) { | |
|
47 | failure(data, textStatus, xhr); | |
|
48 | } else { | |
|
49 | alert("error processing request: " + textStatus); | |
|
50 | } | |
|
47 | 51 | }); |
|
48 | 52 | return request; |
|
49 | 53 | }; |
|
50 | var ajaxPOST = function(url,postData,success) { | |
|
54 | var ajaxPOST = function(url, postData, success, failure) { | |
|
51 | 55 | var sUrl = url; |
|
52 | 56 | var postData = toQueryString(postData); |
|
53 | 57 | var request = $.ajax({type: 'POST', data: postData, url: sUrl, |
@@ -56,7 +60,11 b' var ajaxPOST = function(url,postData,suc' | |||
|
56 | 60 | success(data); |
|
57 | 61 | }) |
|
58 | 62 | .fail(function(data, textStatus, xhr){ |
|
59 | alert("error processing request: " + textStatus); | |
|
63 | if (failure) { | |
|
64 | failure(data, textStatus, xhr); | |
|
65 | } else { | |
|
66 | alert("error processing request: " + textStatus); | |
|
67 | } | |
|
60 | 68 | }); |
|
61 | 69 | return request; |
|
62 | 70 | }; |
General Comments 0
You need to be logged in to leave comments.
Login now