How can I send PHP variable sprod into ajax i need to send this id to check.php page
<script>
function getState(val) {
$.ajax({
type: "POST",
url: "check.php",
data: {id: val, id2:$prod },
dataType:'json',
success: function(data){
$("#style_code").children().remove();
$("#style_image").children().remove();
data.option.forEach(function (item) {
$("#style_code").append('<option value="' + item.color_name + '">' + item.size + '</option>');
$('#style_image').append('<img src="images/'+item.image_name+'" data-imagezoom="true" class="img-responsive" alt="" />')
//$("#style_image").html(data);
});
}
});
}
</script>