Hi,
I'm trying to add items by ajax.
I'm triggering this method "add.owl.carousel" for adding, but when i add item its giving this error "TypeError: content.find is not a function" at 1390 line.
What should I do .
My code
jQuery('#yyy).on(
'translated.owl.carousel add.owl.carousel', function(e) {
console.log(e.type);
if(e.item.count==e.item.index){
var pos = e.item.index;
jQuery.ajax({
type : "post",
url : ajaxurl,
async:false,
data : {'action': 'yfun', 'offset': offset,'width':c_width},
success: function(response) {
if(response!=1){
offset++;
$('#yyy').trigger('add.owl.carousel', [response,e.item.count]);
}
}
});
}
});
response coming in this format:
< li >< h 3 >C h 3>< / li>< li >< h3 >D< / h 3>< / li>
Please tell me what i missing here. I'm stuck for 1 day :(
2 things-
jQuery('<div class="owl-item">' + html + '</div>') <div calss='owl-item'> </div>hence ur code will become-
$('#yyyy').owlCarousel().trigger('add.owl.carousel', [jQuery('<div class="owl-item">' + html + '</div>')]).trigger('refresh.owl.carousel');
Most helpful comment
2 things-
jQuery('<div class="owl-item">' + html + '</div>')<div calss='owl-item'> </div>hence ur code will become-
$('#yyyy').owlCarousel().trigger('add.owl.carousel', [jQuery('<div class="owl-item">' + html + '</div>')]).trigger('refresh.owl.carousel');