AJAX傳值沒反應

不曉得哪邊有問題,麻煩高手幫忙看一下,感謝

<tr id=\"s_<?php echo $id?>\" value=\"<?php echo $id?>\">
<div class=\"search_class\">
<form id=\"form\" >
<label>关键字
<input class=\"keyword\" type=\"input\" name=\"keyword\">
</label>
<label>排序
<select class=\"order\" name=\"order\">
<option value=\"1\">高</option>
<option value=\"2\">低</option>
</select>
</label>
</form>
</div>
<div class=\"content\">
//content
</div>
</tr>

<script>
$(function(){

$('.search_class form input[type=text]').on('keyup',function(){
var id = $(this).parents('tr').attr('value');
test(id);
})

$('.search_class form select').on('change',function(){
var id = $(this).parents('tr').attr('value');
test(id);
})

})

function test(id){
var t_div = $('#s_'+id+' div.search_class');
$.post('/test',$('#form').serializeArray(),function(rs){
t_div.show();
t_div.find('.content').html(rs);
});
}
</script>

評論

Sign In or Register to comment.