2014-07-21 58 views
-1

當我這樣做:jQuery的load()方法錯誤

$("#main").load("list.html"); 

的代碼工作正常,但是當我做:

$.post("mycode.php") 
    .done(function(data) { 
    $("#main").load(data); 
    }) 

和mycode.php是:

$data = file_get_contents("list.html"); 
echo $data; 

我得到:myrootURL/%3C!DOCTYPE 404 not found

我檢查了從後r返回的數據eQUEST的,它正是list.html 任何幫助,請

+0

我想你給從錯誤的URL引用的內容'mycode.php' ..再次檢查你的文件結構.. –

回答

2
$.post("mycode.php") 
    .done(function(data) { 
    $("#main").html(data); //<-html not load 
    }) 
+0

謝謝你,它的工作 –