以下代码经测试通过,根据不同应用可以此代码修改。
Html 及js代码:
<!DOCTYPE html PUBLIC “-//W3C//DTD XHTML 1.0 Transitional//EN” “http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd“>
<html xmlns=”http://www.w3.org/1999/xhtml“>
<head>
<meta http-equiv=”Content-Type” content=”text/html; charset=utf-8″ />
<script type=”text/javascript” src=”jquery-1.3.2.min.js”></script>
<script type=”text/javascript” language=”javascript”>
function GetJsonData() {
$.ajax(
{
type: “GET”,
url: “a.php”,
data: “id=1”,
success: function(data){ $(“#divok”).html(data);},
error: function() { alert(“error”); }
}
)
}
</script>
</head>
<body scroll=”no”>
<input name=”” type=”button” onclick=”GetJsonData()” value=”Click Here” />
<div id=”divok”></div>
</body>
</html>
a.php代码:
<? if($_GET[“id”]==1) {?>
<select name=””>
<option value=”asd”>asdas</option>
<option value=”sad”>sdad</option>
<option value=”sad”>dsad</option>
</select>
<? }?>