1 回答
TA贡献1757条经验 获得超7个赞
将公共类添加到所有应具有突出显示选项的 div
<div class="al-cover">...</div>
为类添加点击事件监听器(jquery 示例)
$(document).on('click', '.al-cover', function (event) {
event.preventDefault();
var id = $(this).prop('id'); //get the id of clicked div
// use ajax request to fetch desired data
$.ajax({
url: '/urlToYourExternalPage',
type: 'POST',
data: {id: id},
success: function( response ) {
response = JSON.parse( response );
// get the data from response
// create the html from data
var html = ....;
// apend the html to target div
$(this).append(html);
},
error: function (xhr, status, error) {
console.log( xhr.responseText );
}
});
});
- 1 回答
- 0 关注
- 173 浏览
添加回答
举报