我想从服务器(服务器2)将html内容接收器追加到当前页面(我从服务器1接收的)的主体中。这是我想达到在加载页面(从服务器1接收)。(所以我从两个不同的服务器获取原始内容。)在使用jquery加载页面时将内容添加到div元素
我尝试使用
function Faulttest() {var myarray=new Array();
var urlarray=new Array();
$(document).ready(function(){
$.get({
url:"http://csce.unl.edu:8080/Anomalies/index.jsp",
data: "html",
success: function(result) {
alert(result);
$('#body').append(result) // result will be the contents received from the server
},
dataType:"text/html"
});
});
// more contents
}
页面的HTML内容分别是:
<body style="font-size:62.5%;" onload="Faulttest();" >
<div id="body" >
<h1>content top </h1>
//HTML CONTENTS GOES HERE
</div>
这是跨域活动。使用'dataType:jsonp',获取更多信息[this](http://api.jquery.com/jQuery.ajax/) – diEcho 2012-07-25 13:32:18
与你的问题并不真正相关(不是说你真的问过一个问题,你只是做了一个问题一系列的语句),但没有一个文档就绪函数_side_ onload函数。 – nnnnnn 2012-07-25 13:35:59