java脚本代码
$("#category select").change(function(){
var category = $('select option:selected').html();
$.ajax({
type:"Post",
url:"collectiepost.php",
data:"category="+category,
cache:"false",
success:function(html){
$("select").html($(html).find("option.category"));
$("#test").html($(html).find("#testdata"));
}
});
});
});
该页面上的 html 输出 collectiepost.php
<select id="ontwerper">
<option class="desinger">vikas</option>
</select>
<select id="category">
<option class="category">cloth1</option>
<option class="category">cloth2</option>
</select>
<div id="testdata">test data</div>
需要输出
<select>
<option class="category">cloth1</option>
<option class="category">cloth2</option>
</select>
<div id="test">
<div id="testdata">test data</div>
</div>
问题
但我得到那些没有 div 标签的输出
<select>
<option class="category">cloth1</option>
<option class="category">cloth2</option>
</select>