我想在点击进入DIV数据容器加载一个PHP页面。但它没有显示任何东西。甚至没有显示错误。这是我的代码。jQuery的.load()不工作
$(".Element").live("click",function(){
alert("Loading Starts");
var file = $(this).find(".file").text();
$("#Viewer").show();
var full = 'directory/file.php?curFile=' + file;
alert(full);
$("#Data").load(full , function(status){ if(status== "error") alert("There is an error");});
alert("Loading Ends");
});
它不会显示在#DATA容器东西。 任何人都可以帮忙吗?
编辑:下面是HTML
<div class="Element">
<div class="file" style="display:none">
myfile.xml
</div>
<div>Some Text</div>
</div>
<div id="Viewer">
<p style="position:absolute; right:0px; top:0px;"onclick='$("#Viewer").hide();'>X</p>
<div id="Data"></div>
</div>
和文件变量的回归是正确的。我通过alert()进行了检查。
直播()是一个过时jQuery函数 – jtheman
什么是请求的URL将其发送? – Gabe
1)你是否也可以发布你的相关HTML。 2)你是否尝试点击一个div并加载不同的页面? – Robert