$(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>
拿到這個劇本,我想多PLE形式使用它,也希望它改變只在形式,任何人可以幫助我,使代碼就這樣
$(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>
非常感謝! – Choo 2010-09-04 13:16:17
@Choo - 歡迎:)請務必通過旁邊的複選標記接受關於此問題和未來問題的答案,以最好地解決您的問題,它有助於下一個來自Google的人,並「關閉」問題:) – 2010-09-04 14:06:27