我想将 html 内容接收器从服务器(服务器 2)附加到当前页面的正文(我从服务器 1 收到)。这是我想在加载页面时实现的(从服务器 1 接收)。(因此我从两个不同的服务器获取原始内容。)
我尝试使用
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>