我编写了一个AJAX调用,但是在成功运行firebug后,显示错误:http://localhost:8000/js/main.js永久移动和404.但是为什么在调用返回成功时搜索js文件。
我的Ajax:
$.ajax({
type:'POST',
url:"/foobar/",
data:{"foo": bar},
success:function(data) {
$('#wrapper').html(data);
}
});
第一反应:
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>Mailserved</title>
<link href="css/new-master.css" rel="stylesheet" type="text/css" />
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.4/jquery.min.js"></script>
<script src="scripts/jquery.editinplace.js"></script>
<script src="scripts/main.js" type="text/javascript"></script>
</head
<body>
// Here body .......
</body>
第二次回复
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html lang="en">
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8">
<title>Page not found at /foobar/js/main.js/</title>
<meta name="robots" content="NONE,NOARCHIVE">
<style type="text/css">
html * { padding:0; margin:0; }
body * { padding:10px 20px; }
body * * { padding:0; }
body { font:small sans-serif; background:#eee; }
body>div { border-bottom:1px solid #ddd; }
h1 { font-weight:normal; margin-bottom:.4em; }
h1 span { font-size:60%; color:#666; font-weight:normal; }
table { border:none; border-collapse: collapse; width:100%; }
td, th { vertical-align:top; padding:2px 3px; }
th { width:12em; text-align:right; color:#666; padding-right:.5em; }
#info { background:#f6f6f6; }
#info ol { margin: 0.5em 4em; }
#info ol li { font-family: monospace; }
#summary { background: #ffc; }
#explanation { background:#eee; border-bottom: 0px none; }
</style>
</head>
<body>
<div id="summary">
<h1>Page not found <span>(404)</span></h1>
<table class="meta">
<tr>
<th>Request Method:</th>
<td>GET</td>
</tr>
<tr>
<th>Request URL:</th>
<td>http://localhost:8000/foobar/send/js/main.js/</td>
</tr>
</table>
</div>
<div id="info">
<p></p>
</div>
<div id="explanation">
<p>
You're seeing this error because you have <code>DEBUG = True</code> in
your Django settings file. Change that to <code>False</code>, and Django
will display a standard 404 page.
</p>
</div>
</body>
</html>
</html>
观察:
<th>Request URL:</th>
<td>http://localhost:8000/foobar/send/js/main.js/</td>
这可能会导致问题为什么会这样,以及如何解决
答案 0 :(得分:0)
你的目录索引缺少配偶。
检查你的/ foobar / for index.html等(或任何你有的目录索引)
PS:永久移动不是4004错误。 404是找不到文件