O365 SharePoint CEWP with Javascript Not Loading?
O365 SharePoint CEWP with Javascript Not Loading?
我正在尝试使用"Etherson方法"执行一个示例,以使用JavaScript创建Web部件。我想在自定义库中单独.html和.js文件,如下所示:文件
如果我保持 js 内联,代码按预期工作:
<!DOCTYPE html><html><head>
<title></title>
<script type="text/javascript">
$(function () {
$.ajax({
url: "/mOperations/_api/web/lists/GetByTitle('Demo List')/items", type: "GET", headers: { "accept": "application/json;odata=verbose" },
}).success(function (data) {
var listItemInfo = "";
$.each(data.d.results, function (key, value) {
listItemInfo += "<strong>Title: </strong>" + value.Title + " <strong>Description: </strong>" + value.Description + "<br />";
});
$("#divHelloWorld").html(listItemInfo);
});
});
</script></head><body>
<div id="divHelloWorld">Hello World!</div></body></html>
但是如果我引用一个外部.js文件,就像JavaScript不存在一样(即它永远不会被调用):
<!DOCTYPE html>
<html">
<head>
<meta charset="utf-8" />
<title></title>
<script type="text/javascript" scr="https://mysite.sharepoint.com/mOperations/webparts/SimpleExample/SimpleExample.js"></script>
</head>
<body>
<div id="divHelloWorld">Hello Worlds!</div>
</body>
</html>
我验证了路径 https://mysite.sharepoint.com/mOperations/webparts/SimpleExample/SimpleExample.js 是否正确。
我错过了什么?
您需要在 html 中将 "scr" 更改为 "src"。
<script type="text/javascript" scr="your_js_file.js"></script>
自
<script type="text/javascript" src="your_js_file.js"></script>
相关文章:
- Jquery UI Not Loading
- Google Maps Javascript API is not loading
- JavaScript not loading?
- Ajax Not Loading PHP
- jquery img not loading "scr"
- O365 SharePoint CEWP with Javascript Not Loading?
- Facebook Javascript api not loading
- Opera Mini Jquery AJAX not loading
- Jquery append not loading javascript for element
- has_one / belongs_to not loading
- Footable not loading
- Gruntjs angularjs cordova image not loading up
- Webview not loading javascript
- RequireJS not loading createjs
- openlayers - wms - map not loading
- Internet Explorer 7 Ajax not loading
- onclick not loading iframe
- Facebook Javascript SDK Not Loading
- Jquery Not loading?
- Ruby on rails 4.0 + javascript not loading