0
我使用PHP中的查詢從數據庫中檢索相同的數據。我將這張照片作爲json發送給Javascript。我得到的JavaScript編碼的json字符串,我解析它
data = JSON.parse(request.responseText);
現在我打印的數據在html中。一切正常。除照片外。 這是我的打印數據和照片:從javascript中打印照片
tab.innerHTML += "<p>"+data[h].product_name+"</p>";
tab.innerHTML += "<p><img src="+data[h].product_photo+" alt='sorry no image'></p>";
我得到這個錯誤
Not allowed to load local resource: file:///E:/xampp
localhost/:1 GET http://localhost/images/ 404 (Not Found)
alt='sorry:1 GET http://localhost/gamo9/css3_tabbed_nav/alt='sorry 404 (Not Found)
null:1 GET http://localhost/gamo9/css3_tabbed_nav/null 404 (Not Found)
我應該怎麼辦?
其一個網址: E:xampp \t mpphpD58F.tmp – user784512
如果mpphpD58F.tmp是它出來的那麼它只是文件名,你需要添加像hxxp://example.com/....這樣的東西才能從服務器加載。例如,如果您的服務器是本地主機,並且圖像託管在默認路徑上,那麼您的代碼應如下所示: (使用http重新啓動hxxp) – roxan