視圖我下面道場移動教程Part 2了404錯誤,當負載定製道場延伸JS
而且要實現延長滾動視圖。我把代碼放在FeedView.js和SettingsView.js中,然後調用它們。但是當加載它們時,會顯示此錯誤。我怎麼修復它?
Failed to load resource: the server responded with a status of 404 (Not Found) http://127.0.0.1/demo/js/FeedView.js
我把我的代碼下的nginx服務器,目錄結構是這樣的
演示
_js
_FeedView.js
_SettingsView.js
_index .html
這裏是HTML文件
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-type" content="text/html; charset=utf-8" />
<meta name="viewport"
content="width=device-width,initial-scale=1,maximum-scale=1,minimum-scale=1,user-scalable=no" />
<meta name="apple-mobile-web-app-capable" content="yes" />
<!-- prevent cache -->
<meta http-equiv="cache-control" content="no-cache">
<meta http-equiv="pragma" content="no-cache">
<title>Dojo Mobile tutorial | Flickrview | Part II | Mockup</title>
<!-- application stylesheet -->
<link rel="stylesheet" type="text/css" href="css/flickerview.css">
<!-- dynamically apply native visual theme according to the browser user agent -->
<script type="text/javascript"
src="http://ajax.googleapis.com/ajax/libs/dojo/1.9.1/dojox/mobile/deviceTheme.js"></script>
<!-- dojo configuration options -->
<script type="text/javascript">
dojoConfig = {
async : true,
baseUrl : './',
parseOnLoad : false,
mblHideAddressBar : true,
packages : [ {
name : "test",
location : "js"
} ]
};
</script>
<!-- dojo bootstrap -->
<script src="http://ajax.googleapis.com/ajax/libs/dojo/1.9.1/dojo/dojo.js" data-dojo-config="async:true"></script>
<!-- dojo application code -->
<script>
// Load the widget parser and mobile base
require([ "dojox/mobile/parser", "dojox/mobile/compat", "dojo/domReady!", "test/FeedView", "test/SettingsView" ], function(parser) {
// Parse the page for widgets
parser.parse();
});
</script>
</head>
<body>
<!-- Settings view -->
<div id="settings" data-dojo-type="test/SettingsView">
...
</div>
</body>
</html>
驗證您的文件夾結構與URL的結構是否相同(例如'demo/js/FeedView.js'),它說它無法找到它,所以您的文件夾結構必須錯誤。試着直接從你的瀏覽器找到你的'FeedView.js'文件,如果這不起作用,那麼你的結構不正確或者你有權限問題。 – g00glen00b
感謝Dimitri,問題已修復,根本原因是FeedView.js的文件名錯誤。 – carmentian