Ver Mensaje Individual
  #2 (permalink)  
Antiguo 13/12/2018, 20:34
Avatar de ArturoGallegos
ArturoGallegos
Moderador
 
Fecha de Ingreso: febrero-2008
Ubicación: Morelia, México
Mensajes: 6.774
Antigüedad: 16 años, 2 meses
Puntos: 1146
Respuesta: Migrar funcion de jQuery 1.4 a 3.3

La funcion On me ha funcionado siempre con elementos que hayan sido creados en el DOM desde el inicio, para tu caso sin conocer tu codigo yo utilizaria el body

Código Javascript:
Ver original
  1. $(function(){
  2.         $("body").on("click", '.vote', function(){
  3.             var rating = $(this).attr("id").substr(0, 1);
  4.             var id = $(this).attr("id").substr(1);
  5.             var data = 'id='+id+'&rating='+rating;
  6.            
  7.             $.ajax({
  8.                 type: 'POST',
  9.                 url: 'voter.php',
  10.                 data: data,
  11.                 success: function(e){
  12.                     $("#r"+id).html(e);
  13.                 }
  14.             })
  15.         });
  16.     });