I got this script from here
$(document).ready(function() {
$('#choose').change(function(event) {
$.post('select-ajax.php', {
selected: $('#choose').val()
},
function(data) {
$('#update').html(data);
}
);
});
});
<form id='form'>
<div id="update"></div>
<select name='selected' id="choose">
<option value="test1">Test1</option>
<option value="test2">Test2</option>
<option value="test3">Test3</option>
</select>
</form>
and i want to use it with multi ple form and also want it change only in that form , can anybody help me to make the code just like this
$(document).ready(function() {
$('#choose').change(function(event) {
$.post('select-ajax.php', {
selected: $('#choose').val()
},
function(data) {
$('#update').html(data);
}
);
});
});
<form id='form'>
<div id="update"></div>
<select name='selected' id="choose">
<option value="test1">Test1</option>
<option value="test2">Test2</option>
<option value="test3">Test3</option>
</select>
</form>
<form id='form'>
<div id="update"></div>
<select name='selected' id="choose">
<option value="1">111</option>
<option value="2">222</option>
<option value="3">333</option>
</select>
</form>