Skip to content
Browse files

modify templates to improve feedback

  • Loading branch information...
1 parent f80ad58 commit 2a6e698784a9a5a42cb273a0da0fcecdd36b3ec9 @mamund mamund committed Jun 6, 2012
Showing with 6 additions and 3 deletions.
  1. +2 −2 javascript.html
  2. +4 −1 nodejs.html
View
4 javascript.html
@@ -7,8 +7,8 @@
xhr.setRequestHeader(<%= @helpers.escape header %>, <%= @helpers.escape value %>);
<% end %>
xhr.onreadystatechange = function () {
- if (this.status == 200 && this.readyState == 4) {
- alert(this.responseText);
+ if (this.readyState == 4) {
+ alert('Status: '+this.status+\nHeaders: '+JSON.stringify(this.getAllResponseHeaders())+'\nBody: '+this.responseText);
}
};
xhr.send(<%= @helpers.escape @body.join('') %>);
View
5 nodejs.html
@@ -11,7 +11,10 @@
headers: {<%= ("#{@helpers.escape header}: #{@helpers.escape value}" for header,value of @headers).join(", ") %>}, <% end %>
method: "<%= @method.toUpperCase() %>"
}, function (error, response, body) {
-<% end %> console.log("Reponse received", body);
+<% end %>
+ console.log("Status", response.statusCode);
+ console.log("Headers", JSON.stringify(response.headers));
+ console.log("Reponse received", body);
});
</section>

0 comments on commit 2a6e698

Please sign in to comment.
Something went wrong with that request. Please try again.