Browse files

added javascript template

  • Loading branch information...
1 parent 09515bb commit 57b29945b45ad084bed658d6da4afe7799180db6 @gr2m gr2m committed with zzen Apr 12, 2012
Showing with 16 additions and 0 deletions.
  1. +16 −0 javascript.html
View
16 javascript.html
@@ -0,0 +1,16 @@
+<section name="javascript">
+ <p class="ioDesc">In</p>
+ <pre class="incoming brush:javascript">
+ var xhr = new XMLHttpRequest();
+ xhr.open('<%= @method.toUpperCase() %>', '<%= @apiUrl %><%= @url %>');
+ <% for header, value of @headers: %>
+ xhr.setRequestHeader("<%= header %>", "<%= value %>");
+ <% end %>
+ xhr.onreadystatechange = function () {
+ if (this.status == 200 && this.readyState == 4) {
+ alert(this.responseText);
+ }
+ };
+ xhr.send(<%= @helpers.escape @body.join('') %>);
+ </pre>
+</section>

0 comments on commit 57b2994

Please sign in to comment.