Advertisement
Guest User

Untitled

a guest
Aug 14th, 2018
101
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.89 KB | None | 0 0
  1. <a class="clicklink" href="/bookDetails" book-id="<%= ID =>"><%= title %></a>
  2.  
  3. <script type="text/javascript">
  4. $(document).ready(function(){
  5.  
  6. $(".clicklink").click(function() {
  7. var bookId = $(this).attr("book-id");
  8. // check what you get
  9. console.log("book id : " + bookId);
  10.  
  11. $.ajax({
  12. type: 'post',
  13. contentType: "application/json; charset=UTF-8",
  14. data: JSON.stringify({ID:bookId}),
  15. url: 'http://localhost:3000/bookDetails',
  16. success: function(data){
  17. console.log('success');
  18. }
  19. });
  20.  
  21. return false;
  22. });
  23. });
  24. </script>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement