我有一個PHP文件path/renderer/renderImage.php
,它構建並返回一個PNG圖像到瀏覽器。當我使用瀏覽器導航到該URL時,它會在屏幕上顯示正確的圖像。但是,當我嘗試使用下面的代碼路徑/ index.html的到圖像加載到使用jQuery一個DIV ...爲什麼我的LAMP堆棧顯示我的圖像,當我導航到它帶有一個URL但沒有加載它時帶有jQuery和PHP
<!DOCTYPE html>
<html>
<head>
<meta charset='utf-8'/>
....
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script>
<script src="../jquery.colorbox.js"></script>
<script>
$.colorbox({
width:"30%",
inline:true,
href:"#inline_content",
onClosed: function() {
$("#myPic").load('./renderer/renderPicture.php');
$('#myPic').css('display','inline');
}
});
它填滿了奇怪的符號的格...
這裏是目錄結構的圖片:
爲什麼瀏覽器不同的解釋畫面上兩頁?什麼可能導致差異?
而不是.load,而是嘗試使用.html。 .load是ajax請求的簡寫。 – stefancarlton
@stefancarlton,如何有一個文件的路徑作爲html內容的幫助? – mishik
ack,謝謝@mishik。 Plonker瞬間由我!您需要創建一個img元素,然後將SRC放在那裏。 – stefancarlton