I got a dropdownlist from which I want to post the value to a php script using ajax. I console log the value but what I get is this:
function (a){var b,c,d,e=this[0];{if(arguments.length)return d=m.isFunction(a),this.each(function(c){var e;1===this.nodeType&&(e=d?a.call(this,c,m(this).val()):a,null==e?e="":"number"==typeof e?e+="":…
This is my html/php select list:
<select class="aanbselect" id="aanbieding">
<?
// Haal alle diensten op en stop ze in een dropdownlist
$aanblijst = "SELECT *
FROM snm_content
WHERE catid = 11 AND state = 1 ORDER BY ordering";
$aanblijstcon = $conn->query($aanblijst);
$aanblijstcr = array();
while ($aanblijstcr[] = $aanblijstcon->fetch_array());
foreach($aanblijstcr as $aanblijstje){
if($aanblijstje['id'] != ''){
$lijstoverzicht .= '<option value='.$aanblijstje['alias'].'>'.$aanblijstje['title'].'</option>';
}
}
echo $lijstoverzicht;
?>
</select>
My ajax:
/* Ajax code voor aanbiedingen */
$("#aanbieding").on('change', function() {
var option = $('#aanbieding > option').filter(':selected');
console.log(option.val);
$.post("includes/getaanbieding.php" + option.data, {
filter: option.val()
}, function(result){
$("#aanbiedingviewajax").html(result);
});
});
How can I post the value of an option inside a select tag to getaanbieding.php?