Advertisement
Guest User

Untitled

a guest
Jun 24th, 2019
49
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.88 KB | None | 0 0
  1. function eliminarTarea(e)
  2. {
  3. var id_tarea = this.children[0].getAttribute("data-id");
  4.  
  5. var xhr;
  6.  
  7. if(window.XMLHttpRequest)
  8. xhr = new XMLHttpRequest();
  9. else
  10. xhr = new ActiveXObject("Microsoft.XMLHTTP");
  11.  
  12. xhr.onreadystatechange = function(){
  13. if(xhr.readyState == 4 && xhr.status == 200)
  14. {
  15. var data = xhr.responseText;
  16.  
  17. if(data == 1)
  18. {
  19. var fila = e.currentTarget;
  20. console.log(fila);
  21. }
  22. else
  23. alert("No se pudo eliminar la tarea");
  24. }
  25. }
  26.  
  27. xhr.open("POST", "lib/delete.php", true);
  28. xhr.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
  29. xhr.send("id_tarea=" + id_tarea);
  30.  
  31. e.preventDefault();
  32. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement