Ver Mensaje Individual
  #4 (permalink)  
Antiguo 02/01/2018, 03:32
milotower
 
Fecha de Ingreso: abril-2014
Ubicación: Almería
Mensajes: 58
Antigüedad: 10 años
Puntos: 2
Respuesta: Evento onclick en CHECKBOX que solo entra al segundo

Muchas gracias,

estábais en lo cierto. Lo he solucionado así:

Código Javascript:
Ver original
  1. function guardar_confirmar(idcheckbox) {
  2.  
  3.                             var checkbox = document.getElementById(idcheckbox),
  4.  
  5.                                 ajax = function(url){
  6.                                     var xhr = window.XMLHttpRequest ?
  7.                                         new XMLHttpRequest() :
  8.                                         new ActiveXObject("Microsoft.XMLHTTP") ||
  9.                                         new ActiveXObject("Msxml2.XMLHTTP");
  10.  
  11.                                     xhr.open("GET", url, true);
  12.                                     xhr.send(null);
  13.                                 };
  14.                             var estado = checkbox.checked ? 1 : 0;
  15.                             var id = checkbox.getAttribute("id-vehiculo");
  16.                             var url = "/admin/editar-detalle-cobro.php?estado=" + estado + "&idcheckbox=" + idcheckbox + "&confirmar=1" + "&id=" + id;
  17.                             ajax(url);
  18.                         }

¿Qué os parece?