Advertisement
Guest User

Untitled

a guest
Jul 20th, 2017
52
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.65 KB | None | 0 0
  1. function listProducts() {
  2. $.get("./listProducts", function(data) {
  3. data.forEach(function(item) {
  4. var $clone = $('#product').clone().removeAttr('id');
  5. $clone.find('.productName').text(item.nameEn);
  6. $clone.appendTo('#rowProducts');
  7. });
  8. });
  9. };
  10.  
  11. $(document).ready(function() {
  12. $('#validProduct').on("click", function(e) {
  13. ......
  14. $.ajax({
  15. type : "POST",
  16. contentType : "application/json",
  17. url : "./addProduct",
  18. data : JSON.stringify(product),
  19. dataType : 'json',
  20. timeout : 6000,
  21. success : function(data) {
  22. /* **reload listProducts** */
  23. }
  24. });
  25. });
  26. });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement