Advertisement
Guest User

Untitled

a guest
May 4th, 2016
43
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.02 KB | None | 0 0
  1. <!DOCTYPE html>
  2. <html lang="en">
  3. <head>
  4. <meta charset="UTF-8">
  5. <title>Exercise 2</title>
  6. <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.0/jquery.min.js"></script>
  7. </head>
  8. <body>
  9. <h1>Exercise 2</h1>
  10. <!-- Place HTML markup here-->
  11. <!-- <form action="" id="contactForm" onsubmit="submitForm()"> -->
  12. Contact ID: <input type="text" name="contact" value="" id="contactID"/><br />
  13. <button type = "button" onclick="submitForm()">click me</button>
  14. <input type="submit" name="submit" value="Submit" /><br />
  15. <!-- </form> -->
  16. <div id="output"></div>
  17. </body>
  18. <script type="text/javascript" src="static/js/entries/exercise2.js"></script>
  19. <script type="text/javascript">
  20. function submitForm(){
  21. var id = $('#contactID').val();
  22. var urlString = "/api/index.php/contact/" + id + ""
  23. console.log(urlString);
  24. $.ajax({
  25. url: urlString,
  26. type: "GET",
  27. }).done( function(data){
  28. $("#output").html(data);
  29. });
  30. }
  31. </script>
  32. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement