I want to sent a variable on an ajax call when I click on a button. The button has an id and on click of the button the id should pass through the ajax call to a php file
<button class="btn-view-products" id="mangoes">View Products</button>
and my js is
var gallery = $("#product-gallery");
var viewproducts = $('.btn-view-products');
viewproducts.click(function(){
pid = $(this).attr('id');
gallery.load("gallery.php?id="+ pid, hideLoading);
});
and in my php
$fname = $_GET["pid"];
$images_dir = "images/products/".$fname."/showcase/";
I am not getting the id value in php. please help. thanks a ton in advance.