Skip to content

Commit 429c4fd

Browse files
William RianchoWilliam Riancho
authored andcommitted
Merge pull request #1 from Costent/Costent-patch-1
Use deferred object instead of callbacks
2 parents 438f93f + dd5ec52 commit 429c4fd

File tree

1 file changed

+11
-8
lines changed

1 file changed

+11
-8
lines changed

javascript.mustache

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -35,13 +35,16 @@ $.ajax({
3535
{{/body.has_url_encoded_body}}
3636
{{#body.has_json_body}}
3737
contentType:"application/json",
38-
data:JSON.stringify({{{body.json_body_object}}}),
38+
data:JSON.stringify({{{body.json_body_object}}})
3939
{{/body.has_json_body}}
40-
success:function(data, textStatus, jqXHR){
41-
console.log("HTTP Request Succeeded: " + jqXHR.status);
42-
console.log(data);
43-
},
44-
error:function(jqXHR, textStatus, errorThrown){
45-
console.log("HTTP Request Failed");
46-
}
40+
})
41+
.done(function(data, textStatus, jqXHR) {
42+
console.log("HTTP Request Succeeded: " + jqXHR.status);
43+
console.log(data);
44+
})
45+
.fail(function(jqXHR, textStatus, errorThrown) {
46+
console.log("HTTP Request Failed");
47+
})
48+
.always(function() {
49+
/* ... */
4750
});

0 commit comments

Comments
 (0)