大家好我有工作multiselect篩選器從此源下載http://www.erichynds.com/,我想用這與Ajax,雖然我的AJAX功能正在工作,並顯示在window.alert(html)
由php生成的HTML,但多選fileter沒有效果,我真的不知道如何解決它。這是我迄今所做的阿賈克斯成功塊產生如何使用多選篩選器與AJAX
HTML
<table>
<tr>
<td>
<select id='pr_select' name='prj' onChange='show("pr_select","output1");' >
<option value='28'>28</option>
<option value='29'>29</option>
<option value='30'>30</option>
</select>
</td>
</tr>
<tr>
<td>
<div id='output1'></div></td>
</tr>
</table>
JAVASCRIPT
<script>
function show(sel,id) {
var selected = $("#"+sel).val();
$("#"+id).html("");
if (selected.length > 0) {
$.ajax({
type: "GET",
url: "get_data.php",
data: "select="+selected,
cache: false,
beforeSend: function() {
$("#"+id).html('<img src="loader.gif" alt="" width="24" height="24">');
},
success: function(html) {
// Ajax is success but multiselect is not working.....
window.alert(html),
$("#"+id).html(html);
}
});
}
}
$(document).ready(function(){
$("#test").multiselect();
});
</script>
輸出 -window.alert
<select id='test' name='multiple_data[]' multiple='multiple'>
<option value='USA'>USA</option>
<option value='UK'>UK</option>
</select>
我甚至嘗試了output1
師也是這樣沒有運氣
$(document).ready(function(){
$("#output1").multiselect();
});
對不起,它不工作:( – user3304642