我买了一个模板并向作者询问但到目前为止仍然没有回复。实际上,我需要一个快速的答案。这里的任何人都可以帮忙解决问题吗?
即将显示单个产品详细信息的快速查看,以便在单击链接时在窗口弹出窗口中显示。当弹出窗口出现时,我不知道如何放置任何数据并获取数据,没有浏览器刷新。请不要问我做了什么,我根本不知道。我通常在表格中使用ajax。
html链接是这样的:
<div class="quick-view">
<a title="Quick view" class="search" href="#"></a>
</div>
和ajax电话:
$(document).on('click','.quick-view .search,a.quick-view',function(){
var data = {
// data here....
}
$.post('quick_view.php', data, function(response){
$.fancybox(response, {
// fancybox API options
fitToView: false,
autoSize: false,
closeClick: false,
openEffect: 'none',
closeEffect: 'none'
}); // fancybox
// OWL Product thumb
$('.product-img-thumb .owl-carousel').owlCarousel(
{
dots:false,
nav:true,
navText:['<i class="fa fa-angle-left"></i>','<i class="fa fa-angle-right"></i>'],
margin:21,
responsive : {
// breakpoint from 0 up
0 : {
items : 2,
},
// breakpoint from 480 up
480 : {
items : 2,
},
// breakpoint from 768 up
768 : {
items : 2,
},
1000 : {
items : 3,
}
}
}
);
})
return false;
})
任何答案都表示赞赏。
答案 0 :(得分:0)
如果您向触发事件的元素添加ID,您可以访问并使用它的ID或其他属性将其作为AJAX调用中的数据发送。为此,您可以使用event.target指向触发事件的元素。通过这种方式,您可以对同一页面上的一大堆元素使用相同的调用:
$(document).on('click','.quick-view .search,a.quick-view',function(event){
// Get the id of the element and add it to the data sent with call
var data = {
elementId: event.target.id
}
// Rest of your Ajax call
}