lazyload ajax images not working
I'm trying to lazyload images called via ajax.
But the console is throwing an error message saying "$(...).lazyload is not a function" despite the fact that i've tried embedding/linking the lazyload plugin. I am at a loss. Please help.
I am successfully able to call data via ajax only the lazyload images are not working.
$.ajax({
url: url,
type: "GET",
dataType: 'json',
success: function(data) {
appendJsonData(data);
//on json success init lazyLoad
$("img.lazy").lazyload({
effect: 'fadeIn',
load: function(){
var $this = $(this);
$this.addClass("lazyLoadedX")
}
});
},
error: function(req, txt, err) {
var errObj = JSON.parse(req.responseText);
console.log(errObj.message);
}
});
Thanks