hi mates!!! im a begginer in jquery and i have a big problem for me... i have a static combobox and i do a query to the database for get the genre and compare this value with the values of the combobox but the json value replace me the first value of the combobox an then the list of the combobox show me the same two values for example; my combobox look like that:
<select name="sexoAlumno" id="sexoAlumno" >
<option value="1">Masculino</option>
<option value="2">Femenino</option>
</select>
so when json bring m,e the value of the genre if this value is Femenino then my combobox look like that
<select name="sexoAlumno" id="sexoAlumno" >
<option value="1">Femenino</option>
<option value="2">Femenino</option>
</select>
my json code is:
$(document).ready(function(){
$("#rutAlumno").blur(function(){
$.ajax({
type: "POST",
url: "../class/Personas.php",
data: "rutAlumno="+0+$("#rutAlumno").val(),
dataType: "json",
success: function(aResponseData, aStatus, aJqX){
$("#nombreAlumno").val( aResponseData[0].nombreAlumno );
var sexoAlumno = $("#sexoAlumno option:selected").val(aResponseData[0].sexoAlumno).html(aResponseData[0].sexoAlumno);
$("#gradoAlumno").val( aResponseData[0].gradoAlumno );
$("#reparAlumno").val( aResponseData[0].reparAlumno);
$("#mailAlumno").val( aResponseData[0].mailAlumno );
$("#fonoAlumno").val( aResponseData[0].fonoAlumno);
})
});
//*********************************************
how i should do it for show the same value from both sides (from database and combobox) without replace the values of my combobox i hope u can understand my english greetings!!!