1. 如果动态数据是简单,可以直接嵌入js,php中通过echo "document.write('内容');";来输出内容
<script type='text/javascript' language='javascript' src='content.php'></script>
2. 如果动态的数据是比较复杂的,可能需要服务器返回json或者xml-> ajax
$.ajax({
type: "GET",
url: "xxx.php",
success: function(msg){
//对msg进行dom编程
}
});
3. 如果动态的数据是因为用户的某个操作引发的,则可以使用jquery的事件绑定来处理
$(#id).click(fucntion(){
$.ajax({
type: "GET",
url: "aaa.php",
success: function(msg)
{
//对msg进行dom编程
}
});
});