I want to load my popup center in body. I have tried to do that. but its not working.
Here is my link : http://sriads.com/shopping/product/ (click Add to Cart
button)
this script from :
http://dinbror.dk/bpopup/
head style
<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>
button html
<button type="button" class="button small cart-button" data-id="2222">Add to Cart</button>
ajax.php file
<div id="popup">
<div class="inner">
<h2>Item added to your cart!</h2>
<!-- here some html and php codes -->
</div>
</div>