[英]Browser attempting to open Javascript code as file structure
嘗試加載我的網站時遇到錯誤。 每當我在瀏覽器中打開index.html
, problem loading page
響應時都會出現problem loading page
。 響應令人困惑,因為通常我希望這表明無法加載文件,但是響應顯示如下:
Firefox can't find the file at /home/crow/UdacityProjects/mapapp/function (data) { // Setting Self var self = this; this.name = data.name; this.lat = data.lat; this.long = data.long; this.URL = ""; this.street = ""; this.city = ""; this.phone = ""; this.visible = ko.observable(true); // Foursquare URL var foursquareURL = ' https://api.foursquare.com/v2/venues/search?ll= ' this.lat ',' this.long '&client_id=' clientID '&client_secret='
它繼續進行,但是我把其余的留給了空間。 如您所見,它試圖將我的代碼加載到URL中,為什么會發生這種情況?
我已經在瀏覽器似乎試圖加載文件的地方添加了我的JavaScript代碼:
// --- Location information and foursquare URLJSON.
var location = function(data) {
// Setting Self
var self = this;
this.name = data.name;
this.lat = data.lat;
this.long = data.long;
this.URL = "";
this.street = "";
this.city = "";
this.phone = "";
this.visible = ko.observable(true);
這是我的index.html
文件:
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Bolton Hill Neighborhood Map</title>
<link rel="stylesheet" href="static/main.css">
<meta name="viewport" content"width=device-width, initial-scale=1">
</head>
<body>
<div class='map'>maps error</div>
<script src="/js/knockout.js"></script>
<script src="/js/jquery.min.js"></script>
<script src="/js/app.js"></script>
<script async defer src="https://maps.googleapis.com/maps/api/js?key=XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX&callback=initApp&libraries=places" onerror="errorHandler"></script>
</body>
</html>
我的目錄結構如下:
myapp
|
CSS
|
main.css
JS
|
knockout.js
core.js
jquery.min.js
app.js
index.html
我不確定在這里我做錯了什么,如果有人可以給我一些建議,我將不勝感激。 謝謝!
location
是一個Javascript 關鍵字 。 重命名您的變量。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.