0
Java脚本代码股利的HTML代码没有从HTML代码中提取
$("#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"));
}
});
});
});
在该页面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>
HTML输出需要输出
<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>
我已经做了这样的也$( “#测试”)HTML($(HTML).find(“#测试数据”));但不工作 – 2012-07-19 12:25:28
我的意思是什么,改变这行'$( “#DIV测试”)HTML($(HTML).find( “#DIV TESTDATA”));'你有div'之间'空间'#测试'在两个地方。发生了什么事是,AJAX调用看起来与ID =“测试”元素的所有div元素,而不是寻找与ID =“测试” div元素 – qais 2012-07-19 12:28:01
看到我编辑的问题后,我的代码是不能工作 – 2012-07-19 12:30:01