I have a code something like
if($('#nodeNo').val() == null){
cityChange(1);
$('#nodeNo option[value=<%=request.getAttribute("nodeval")%>]').attr('selected','selected');
}
There is an Ajax call in cityChange(1) to populate the nodeNo select list and then the next statement sets the selected value. However due to parallel execution the above code doesn’t work. The ajax call and setting the value executes together. The other Ajax call takes a bit time and by that time the next statement finishes execution. Hence the list is populated correctly but the selected value can’t be set.
Pls Help!!
You have to transfer
into the ajax success callback inside the
cityChangemethod.