script.js 861 B

1234567891011121314151617181920212223
  1. function delete_post(id, title){
  2. if (confirm("Seguro que deseas borrar el post '" + title + "'? Esta accion es irreversible.")){
  3. //window.location.href = "/blog/delete/delete.php?p=" + id;
  4. var xmlhttp;
  5. if (window.XMLHttpRequest){// code for IE7+, Firefox, Chrome, Opera, Safari
  6. xmlhttp=new XMLHttpRequest();
  7. }
  8. else{// code for IE6, IE5
  9. xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
  10. }
  11. xmlhttp.onreadystatechange=function(){
  12. if (xmlhttp.readyState==4 && xmlhttp.status==200){
  13. //document.getElementById("myDiv").innerHTML=xmlhttp.responseText;
  14. location.reload();
  15. }
  16. }
  17. xmlhttp.open("GET","/blog/delete/delete.php?p=" + id, true);
  18. xmlhttp.send();
  19. //location.reload();
  20. }
  21. }