你好,我有这个通过 AJAX 调用加载内容的代码,这些是 vimeo 视频,当我放置静态代码时可以工作......但不是动态加载的内容我尝试了很多解决方案,但对我没有任何帮助,这里是代码:
$(document).ready(function(){
$("a[data-rel^='prettyPhoto']").prettyPhoto();
$(".category").click(function(){
var categoryid = $(this).data('categoryid');
$.ajax({
url:'<?php echo base_url() ?>main/getPortfolioVideos',
type:'POST',
data: { category_id: categoryid, page_slug: "index" }
}).done(function(data){
var rows = $.parseJSON(data);
var videodata = "";
$(rows).each(function(index, value){
$.each(value, function(k, v){
if(k == "video_link"){
videodata += '<article class="entry"> <a data-rel="prettyPhoto" href="http://vimeo.com/'+ v +'">';
videodata += '<iframe src="http://player.vimeo.com/video/'+ v +'" width="270" height="160" frameborder="0" webkitallowfullscreen="" mozallowfullscreen="" allowfullscreen="">';
videodata += '</iframe><span class="video-hover"></span> </a> </article>';
}
console.log(k+":"+v);
});
})
$(".portfolio").html(videodata);
});
});
});