js
$.ajax($url + '/jxkh/S0008F0036', {
dataType: 'json',
type: 'post',
timeout: 10000,
success: function(data) {
var newshtml = "";
$.each(data.data.list, function(index, element) {
newshtml += '<div class="news-bar"><h2 class="layui-colla-title news-tit">' + element.cont +
'</h2><button class="layui-btn layui-btn-sm layui-btn-normal news-btn parentIframe" id="' + element.id +
'">查看详情</button></div>'
})
$(".news-box").append(newshtml);
$(".news-btn").click(function() {
idlink = this.id;
var dhtml = "";
layer.open({
type: 1,
shadeClose: true,
shade: false,
title: false,
maxmin: true,
area: ['893px', '600px'],
success: function(layero, index) {
$.ajax($url + '/jxkh/S0008F0037', {
data: {
id: idlink
},
dataType: 'json',
type: 'post',
timeout: 10000,
success: function(data) {
dhtml = (data.data.list[0].cont);
$(".layui-layer-wrap").html(dhtml);
var imglk = ($url + '/');//动态路径
var imgall = $(".warp").find("img");//返回所有图片
$(imgall).each(function(){
var imgl = $(this).attr("src");//返回图片链接
var imglkall = imglk + imgl; //动态路径+返回图片链接
$(this).attr("src",imglkall);//替换原图片链接
})
},
error: function(xhr, type, errorThrown) {
}
});
},
content: $('body').html(whtml),
end: function() {
location.reload();
}
});
});
},
error: function(xhr, type, errorThrown) {
}
});
网友评论