I am using ajax to post data to a php page but the response does not return.
$('#card_list select').live('change', function() {
var productID = $(this).attr('value');
var divID = $(this).attr('id');
$.ajax({
type: "POST",
url: "inc/change_thumbnail.php",
data: "products_id="+productID,
cache: false,
success: function (response) {
alert(productID);
alert(divID);
$("#"+divID).attr("src", response);
},
error: function (err) {
alert('Sorry, no thumbnail for product');
}
});
})
on the php page is the following
<?php
$products_id = $_GET["products_id"];
echo "img/products/thumb/".$products_id.".jpg";
?>
it is supposed to swap a products thumbnail. but the $product_id variable is not picked up.