A few easy questions

A few easy questions

Hello, everyone,
The question is rather simple. How do I ( with example, please ) ;

1. Create a simple update/delete user interface


2. Use at least one jQuery UI, such as sortable, draggable, dialog,... )


3. Add a jQuery animation


Thank you in advance! :D

  1. $(document).ready(function(){ 
  2. var API=" http://193.246.33.24/data/
  3. var users = $("#users"); 

  4. $.get(API, {user:13}, function(data){ 
  5. $.each(data, function(i, usr){ 
  6. addUser(usr); 
  7. }); 
  8. }); 

  9. function addUser(usr){ 
  10. users.append("<tr data-id=" + usr.id + "><td>"+ usr.name + "</td><td>" + usr.surname + "</td><td><button class='btn btn-danger delete'>Delete</button></td></tr>"); 

  11. }; 

  12. var dialog = $( "#dialog" ).dialog({ 
  13. autoOpen : false, 
  14. modal : true, 
  15. buttons:{ 
  16. "Dodaj novog" : function(){ 
  17. form.submit(); 
  18. }, 
  19. Cancel: function(){ 
  20. dialog.dialog("close") 
  21. }, 
  22. close: function() { 
  23. form[0].reset(); 
  24. }); 
  25. $("#addNew").on("click", function(){ 
  26. dialog.dialog("open"); 
  27. }); 

  28. var form = dialog.find("form"); 

  29. form.on("submit", function(e){ 
  30. e.preventDefault(); 

  31. $.post(API + "create", form.serialize()).done(function(data){ 
  32. addUser(data); 
  33. dialog.dialog("close"); 
  34. }).fail(function(error) { 
  35. console.log(error.responseText); 
  36. }) 

  37. }); 

  38. users.on("click",".delete", function(){ 
  39. var row = $(this).closest("tr"); 
  40. $.post(API + "destroy/" + row.data("id"), {}, function(data){ 
  41. row.fadeOut(function(){ 
  42. $(this).remove(); 
  43. }); 
  44. }); 
  45. }); 


  46. });
193.246.33.24
[ { "user": 999, "name": "Pero", "surname": "Perić", "createdAt": "2015-05-29T11:46:00.034Z", "updatedAt": "2015-05-29T11:49:26.915Z", "id": 7 }, { "user": 2, "name": "Bareuu", "surname": "svirajMajkeu", "createdAt": "2015-05-29T11:51:56.808Z", "updatedAt": "2015-05-29T11:56:51.319Z", "id": 10, "hob…
193.246.33.24