I have trawled the internet over the past few hours to find out the best way to add a view product button to my website. I have seen it done via a Bootstrap Modal but i don't want a modal, i want the product to display on a fresh page (Products.php).
i have created a button to view the products, and started to code an Ajax call
function productdetails(id){
var data = {"id":id};
jQuery.ajax({
url : 'products.php',
method : "post",
data : data,
success : function(data){
jQuery('body').append(data);
},
error : function(){
alert("Something went wrong!");
}
});
}
but i know with a modal you need to add:
JQuery('#modalname').modal ('toggle')
Anybody got any suggestions, as it seems all websites are using this method of a new page for product details rather than a modal.