【发布时间】:2015-06-29 02:16:19
【问题描述】:
我想在正文中加载我的弹出中心。我已经尝试过这样做。但它不工作。
这是我的链接:http://sriads.com/shopping/product/(点击Add to Cart按钮)
this script from :http://dinbror.dk/bpopup/
头部样式
<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>
jQuery
<script>
jQuery(function ($) {
$('.button').on('click', function () {
var id = $(this).data('id');
$.ajax({
url: '/shopping/ajax.php',
data: {
id: id
},
method: 'POST',
success: function (html) {
$('body').append(html);
$(html).bPopup();
},
error: function (returnValue) {}
});
});
});
</script>
按钮 html
<button type="button" class="button small cart-button" data-id="2222">Add to Cart</button>
ajax.php 文件
<div id="popup">
<div class="inner">
<h2>Item added to your cart!</h2>
<!-- here some html and php codes -->
</div>
</div>
【问题讨论】:
-
对我有用,它就在中心,但这可能有助于stackoverflow.com/questions/5703552/…
-
贴出你在scripting.min.js中应用的样式代码
标签: javascript jquery html css ajax