Can anyone help me with this code? I assume that I do not understand about 80%, I am trying to pop the INFO div after selecting one of the options in the SELECT field, this information will be relative to the selected option, the information regarding the selected option is contained in the example.php page ... The way that is, it is working, but the information is being presented within an OPTION, I would at least want it to be populated within an INPUT
<html>
<head>
<title>Exemplo</title>
<script type="text/javascript" src="jquery.js"></script>
</head>
<body>
<label for="montadora">Montadora:</label>
<select name="montadora" id="montadora">
<option value="1">Fiat</option>
<option value="2">Ford</option>
<option value="3">Volkswagen</option>
</select>
<br />
<label for="veiculo">Veiculo:</label>
<select name="veiculo" id="veiculo"></select>
<div id="INFO">
</div>
<script type="text/javascript">
$(document).ready(function(){
$("#montadora").change(function(){
$.ajax({
type: "POST",
url: "exemplo.php",
data: {montadora: $("#montadora").val()},
dataType: "json",
success: function(json){
var options = "";
$.each(json, function(name, value){
options += '<option value="' + name + '">' + name + '</option>';
});
$("#veiculo").html(options);
}
});
});
});
</script>
</body>
</html>