Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

197
Vistas
owl Carousel is not working after ajax success in python Django

I want to get the parent category list on the slider by clicking the main category's slider list. the second category's sider is not working when I click the main category.

$('.maincategory').owlCarousel({ });

  $(".box").on("click", function(){
     var value= this.id.toString();
     var csr =$("input[name=csrfmiddlewaretoken]").val();
     debugger
     $.ajax({
                 url: 'getParentCategory',
                 type: 'POST',
                 data: {
                 id: value,
                 csrfmiddlewaretoken: csr 
                    },
                 success: function (response) {
                    data = response.results
                    AppendData(data);
                 }
           });
     
   });
   
   function AppendData(data){
     $(".secondCategory").empty();
     debugger;
     var htmls = '';
     if(data.length != 0){
        for (var i = 0; i < data.length; i++) {
           htmls += '<div class="item eight-card-single text-center">'
              htmls += '<a id="{{value.id}}" class="second-category category">'
              htmls +='<img src="/media/uploads/products/logo.jpg">'  
              htmls +='<h5 id="'+ data[i].name +'" class="card-title">'+ data[i].name +'</h5>'
              htmls +='</a>'
              htmls +='</div>'
     }
     $(".secondCategory").append(htmls);
        $('.secondCategory').owlCarousel({            
        });
     } else {
        $(".secondCategory").append("No data");
        
     }
     };
about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

The .empty() method clears element content but doesn't destroy the existing Owl carousel instance on that element, you need to this with $(".secondCategory").trigger("destroy.owl.carousel") before setting the new html content and creating a new Owl carousel instance.

about 4 years ago · Juan Pablo Isaza Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda