2012-05-12 46 views
1

我创建了一个下拉列表,这是在单独的页面正常工作: normaljQuery.post输出下拉列表

然而

,当我在PP页面使用jQuery.post()将其输出到一个表,内容运行出从下拉列表中: abnormal

jQuery的,我现在用我们这样的:

<script> 
function showestate(){ 
$.post('admin/page/ur/showestate.php',{ 
zid: document.getElementById('zone').value 

}, 
function(output){ 
$('#showestate').html(output); 
}); 
} 
showestate(); 
</script> 

<div id='showestate'> 
    </div> 

请帮助!谢谢!

下拉列表是这样的:

<?php 
include "../../db.php"; 
session_start(); 

?> 
<select name="estate" id="estate" /> 
<?php 
$sql_sel_estate = "select * from [estate]"; 
$result_sel_estate = mssql_query($sql_sel_estate, $conn); 
while ($record_sel_estate = mssql_fetch_array($result_sel_estate)) 
{ 
$estateid = $record_sel_estate['estateid']; 
$estatename = $record_sel_estate['estatename']; 
$estatenameen = $record_sel_estate['estatenameen']; 
$estatezoneid = $record_sel_estate['estatezoneid']; 
$estatecode = $record_sel_estate['estatecode']; 

?> 

<option value="<?=$estateid?>"> 
<?=$estatenameen?><br> 
</option> 
<?php 
} 
?> 
</select> 
+2

请提供有关此的更多信息,php代码... –

+0

请显示响应是什么。 – epascarello

回答

1

您必须检查/警惕什么回来在output

它应该包含

<option>option 1</option> 
<option>option 2</option> 
<option>option 3</option> 

即只有选项。没有其他的HTML。没有其他的。

还创建了一个<select>元素,其ID为showestate。您可以给任何其他ID ,因为您将html添加到showestate