Trying to insert a car image from one of my databases into my webpage
get_new_car_pictures:
$make = $_REQUEST['make'];
$model = $_REQUEST['model'];
$query = "SELECT * FROM database_new WHERE make = $make AND model = $model";
$car = $db->get_row($query);
$img = $car['img_url'];
echo "<img src=".$img." />";
ajax function:
function insertImageAJAX(){
return $.ajax({
type: 'GET',
url: '/ajax/get_new_car_pictures.php',
data: "model=" + params.model + "&make=" + params.make,
success: function(data){
$("#car-image".html(data));
}
}
});
car-image is the div where I want the image to appear
I have tried to follow Ajax tutuorials online but for whatever reason, this is not working...