var ajaxUrl = '/ajaxpost';
var modifyUrl = '/aanpassen/';
$(document).ready(function() {
$('a[@rel$="blank"]').click(function(){
this.target = "_blank";
});
$('div.product-detail').hide();
$('.product').toggle(function(){
$(this).children('.product-detail').animate({ opacity: 'show' }, 'slow');
},function(){
$(this).children('.product-detail').animate({ height: 'hide', opacity: 'hide' }, 'fast');
});
$('a.order').click(function(e){
e.preventDefault();
var productId = $(this).parents('.product-detail').children('.product-id').html();
var target = $(this);
$.post(
ajaxUrl,
{ action: 'add-product', productid: productId },
function(modifyid){
if (modifyid > 0) {
target.html('Product is toegevoegd.');
window.location.href = (modifyUrl + modifyid);
} else {
target.html('Product is niet toegevoegd.');
}
}
);
});
});