我有两个普通的html文件。首先在左侧有一棵树,从中选择一个类别,然后根据所选内容在右边显示html文件。文件夹结构为/ main / Pages,主文件夹包含主html,Pages文件夹为子htmls。
问题: IE & Firefox -工作,但不加载子页面的样式,也不执行其document.ready函数,Chrome-404错误
这一切背后的jQuery:
$(document).ready(function () {
$('.child').hide();
$('.parent').click(function (event) {
event.preventDefault();
$('.child', $(this).parent()).slideToggle('slow');
});
$('a').click(function(event) {
var innerText = $(this).attr('href');
var elem = $('#' + innerText);
if(elem.length > 0) {
$('#container').load("Pages/" + elem[0].innerHTML + ".html", function(response, status, xhr) {
if (status == "error") {
var msg = "Sorry but there was an error: ";
$("#container").html(msg + xhr.status + " " + xhr.statusText + " <b>"+elem[0].innerHTML+"</b>");
}
});
}
event.preventDefault();
});
});铬头:
URL:file:///D:/PacientData/Pages/labDemandeCode1.html请求
选项file:///D:/PacientData/Pages/labDemandeCode1.html HTTP/1.1
访问-控制-请求-方法:获取
原产地:空
访问-控制-请求-标头:源,X-请求-与,接受
任何对这两个问题的帮助都将是非常感谢的!!
发布于 2012-08-31 02:29:56
如果您的url是好的(查看firebug.)它可能是服务器的响应报头(“HTTP1.1200OK”);有时可以修复此404。
https://stackoverflow.com/questions/8339413
复制相似问题