<script type="text/javascript">
var AjaxParams = function(type,url,global,cache,id){
this.type = type;
this.url = url;
this.global = global;
this.cache = cache;
this.id = id;
}
function getAllId(){
var ids = new Array();
ids.push('aa');
ids.push('bb');
ids.push('cc');
var urls = new Array();
urls.push('http://localhost:8088/TestHttpClient/welcome.jsp');
urls.push('http://localhost:8088/TestHttpClient/world.jsp');
loadAllLink(ids,urls);
}
function loadAllLink(o,urls){
for(var i = 0;i<o.length;i++){
var pp = new AjaxParams("post",
urls[i],
false,false,o[i]
);
$.ajax({
type:pp.type,
url:pp.url,
global:pp.global,
cache: pp.cache,
timeout: 10000,
beforeSend: function(XMLHttpRequest){
},
error:function(){
$("#"+pp.id).html("读取内容错误...");
},
success:function(html){
flush(pp.id,html);
}
});
}
}
function flush(id,html){
alert(id);
$("#"+id).html(html);
}
$(document).ready(function(){getAllId()});
</script>
<body>
This is my JSP page. <br>
<div id="aa" style="background-color: aqua">
</div><br/>
<div id="bb" style="background-color: black;"></div><br/>
<div id="cc" style="background-color: blue;"></div>
</body>
此方法的作用是给不同的div里面引入不同的url,可是现在的效果不是那样。请帮帮我!~~~~~