I am trying to initiate some jQuery ($('#slider').leanSlider();
) after a successful Ajax response. Putting it in the success callback isn't working. I found an answer here that I believe is related but I am having a difficult time understanding what I exactly have to do. How can I get that line to initiate after a successful Ajax response?
$('.post-link').click(function(e) {
e.preventDefault();
var post_id = $(this).attr('rel'),
ajaxURL = site.ajaxurl;
function projectShow() {
$.ajax({
type: 'POST',
url: ajaxURL,
data: {'action': 'load-content', post_id: post_id },
success: function(response) {
$('#project-container').html(response);
$('#slider').leanSlider(); <--// This isn't initiating
}
return false;
}
});
}
projectShow();
});