I am trying to use jQuery methods for ajax to create a dropdown menu. Using this jQuery code:
JAVASCRIPT:
<SCRIPT>
$("select[name='carid']").on("change", function() {
$.post(
"execute.php",
{ carid: $("#carid").val() },
function(data) {
$("available").append(data);
}
);
});
</SCRIPT>
execute.php :
<?php
$carid = $_POST['carid'];
$result = mysql_query("SELECT mID, mName FROM Model WHERE cID = '$carid' ");
$select = "<select>";
while ($row = mysql_fetch_array($result))
{
$mID = $row['mID'];
$mName = $row['mName'];
$select+= "<option value='".$mID."'>" .$mName. "</option>";
}
$select += "</select>"
echo $select;
?>
Unfortunately I am getting this error on loading in console event.returnValue
is deprecated. Please use the standard event.preventDefault()
instead. Any help is much appreciated.