Created
August 13, 2014 17:32
-
-
Save bcho/860bba8ac29aee83c559 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <!DOCTYPE html> | |
| <html lang="en"> | |
| <head> | |
| <meta charset="UTF-8"> | |
| <title>HTTP Verbs Test</title> | |
| </head> | |
| <body> | |
| <section class="verb"> | |
| <header> | |
| <h3 class="name">GET</h3> | |
| <pre class="result"></pre> | |
| <button class="go" data-method="get">go</button> | |
| </header> | |
| </section> | |
| <section class="verb"> | |
| <header> | |
| <h3 class="name">POST</h3> | |
| <pre class="result"></pre> | |
| <button class="go" data-method="post">go</button> | |
| </header> | |
| </section> | |
| <section class="verb"> | |
| <header> | |
| <h3 class="name">PUT</h3> | |
| <pre class="result"></pre> | |
| <button class="go" data-method="put">go</button> | |
| </header> | |
| </section> | |
| <section class="verb"> | |
| <header> | |
| <h3 class="name">PATCH</h3> | |
| <pre class="result"></pre> | |
| <button class="go" data-method="patch">go</button> | |
| </header> | |
| </section> | |
| <section class="verb"> | |
| <header> | |
| <h3 class="name">DELETE</h3> | |
| <pre class="result"></pre> | |
| <button class="go" data-method="delete">go</button> | |
| </header> | |
| </section> | |
| </body> | |
| <script src="http://cdn.staticfile.org/jquery/2.1.1-rc2/jquery.min.js"></script> | |
| <script> | |
| (function() { | |
| $('button.go').click(function(e) { | |
| e.preventDefault(); | |
| var method = $(this).data('method'); | |
| $.ajax({ | |
| url: 'http://httpbin.org/' + method + '?method=' + method, | |
| type: method | |
| }).done(function(data) { | |
| alert(data.args.method); | |
| }); | |
| }); | |
| })(); | |
| </script> | |
| </html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment