Advertisement
Guest User

Untitled

a guest
Apr 2nd, 2015
205
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.52 KB | None | 0 0
  1. <script>
  2. $("#removeButton").click(function(e){
  3. bootbox.confirm("Are you sure?", function(result) {
  4. if (result == true){
  5. $.ajax({
  6. type: "DELETE",
  7. async: true,
  8. contentType: "application/json",
  9. url: "/v1/item/" + itemID,
  10. dataType: "json",
  11. success:function(result){
  12. location.reload()
  13. },
  14. error:function(){
  15. $("#removeButton").notify("Error in removing item", "error");
  16. }
  17. });
  18. }
  19. else{
  20. console.log("false");
  21. }
  22. });
  23. </script>
  24.  
  25. function removeConfirmButtonPressed(){
  26. $.ajax({
  27. type: "DELETE",
  28. async: true,
  29. contentType: "application/json",
  30. url: "/v1/items/" + itemID,
  31. dataType: "json",
  32. success:function(result){
  33. location.reload()
  34. },
  35. error:function(){
  36. $("#removeButton").notify("Error in removing item", "error");
  37. }
  38. });
  39.  
  40. //event for clicking remove button
  41. $("#removeButton").click(function(e){
  42. bootbox.confirm("Are you sure?", function(result) {
  43. if (result == true){
  44. removeConfirmButtonPressed()
  45. }
  46. else{
  47. console.log("false");
  48. }
  49. });
  50. });
  51.  
  52. });
  53. </script>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement