0
我已經通過這種方式(根據「jerjer」所選答案)嘗試,但未能加載內容..如何使用PHP捲曲加載其他網站的內容到一個div在我的網站
render.php
<?php
$url = 'http://apps.irs.gov/app/withholdingcalculator/index.jsp';
$htm = file_get_contents($url);
echo $htm;
?>
common.js
$(document).ready(function(){
$('#divId').load('render.php');
});
index.html
<html>
<head>
<title>Home</title>
<link rel="stylesheet" href="css/style.css" type="text/css">
<script src="js/jquery.js"></script>
<script src="js/common.js"></script>
</head>
<body>
<div id="divId"></div>
</body>
</html>
任何幫助嗎?在此先感謝...
iframe。 iframe中。 dun dun dun – MightyPork
此代碼無錯誤。 PHP腳本正確返回外部網站的內容? (沒有錯誤?良好的路徑?)嘗試直接打開render.php到你的瀏覽器。 –
爲什麼要使用AJAX加載render.php?爲什麼不在你的索引中使用php? (so index.php),並在其中包含render.php。 –