按钮点击加载弹出窗口..但它停留在主页面上..我想从ajax.php加载它并按钮data-id="1521"
像这样发送ajax.php?id=1521
怎么做plz帮助我此...
css style
<link rel="stylesheet" href="http://dinbror.dk/bpopup/assets/style.min.css">
内容代码
<ul id="products">
<li>
<div class="image"><img src="../someimage.jpg"><div>
<div class="name">Samsung 65' Curved LED 4K TV</div>
<div class="cart"><button type="button" class="button small" data-id="1521">Add to Cart</button><div>
</li>
</ul>
这是jquery popup .. But this one i want to load from ajax.php
<div id="popup">
<span class="button b-close"><span>X</span></span>
If you can't get it up use<br><span class="logo">bPopup</span>
</div>
<div id="popup2">
<span class="button b-close"><span>X</span></span>
<div class="content"></div>
</div>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.11.2/jquery.min.js"></script>
<script src="http://dinbror.dk/bpopup/assets/jquery.bpopup-0.11.0.min.js"></script>
<script src="http://dinbror.dk/bpopup/assets/scripting.min.js"></script>
答案 0 :(得分:3)
为前<div id="popup"></div>"
添加div,并将其放在<script>
var id = $('button').data('id');
$("#popup").load('ajax.php?id='+id);
这将加载新div调用弹出窗口中的内容
要在按钮上实现此效果,请单击向按钮添加ID并在
上调用上述脚本$('#buttonid').on('click',function(){
// the above script
});
答案 1 :(得分:3)