I have a select tag, which option values come from a database via PHP using ajax. The previously selected value is saved in the DB.
I want to display a select showing the previously selected value (which is saved in the DB).
This is the HTML code
<select id='country'></select>
This is the JS code (ajax getting all country list)
$.ajax({
url: 'country.php',
scriptCharset: 'ANSI',
success:function(result) {
$('#country').append(result);
}
});
Let's say I want to show country which value is 27, how can I achieve that?