我的網頁(這裏是an example)與舊的Google圖表API(舊的靜態圖像),我想將它移動到新的Google可視化圖表API。jQuery的Google.load() - 不適用於DataTables.net
我也使用jQuery,jQuery UI的,谷歌地圖JS和DataTables.net(全部託管在谷歌和微軟的CDN):
<style type="text/css" title="currentStyle">
@import "/demo_table_jui.css";
@import "https://ajax.googleapis.com/ajax/libs/jqueryui/1/themes/redmond/jquery-ui.css";
</style>
<script type="text/javascript" src="https://maps.google.com/maps/api/js?sensor=false&language=ru"></script>
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js"></script>
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jqueryui/1/jquery-ui.min.js"></script>
<script type="text/javascript" src="https://ajax.aspnetcdn.com/ajax/jquery.dataTables/1.9.0/jquery.dataTables.min.js"></script>
<script type="text/javascript">
$(function() {
// ...
$("#comments").dataTable({
"bJQueryUI": true,
"sPaginationType": "full_numbers",
"aaSorting": [[0, "desc"]]
});
});
所以我試圖用google.loader();代替腳本標籤:
<style type="text/css" title="currentStyle">
@import "/demo_table_jui.css";
@import "https://ajax.googleapis.com/ajax/libs/jqueryui/1/themes/redmond/jquery-ui.css";
</style>
<script type="text/javascript" src="https://www.google.com/jsapi"></script>
<script type="text/javascript" src="https://ajax.aspnetcdn.com/ajax/jquery.dataTables/1.9.0/jquery.dataTables.min.js"></script>
<script type="text/javascript">
google.load("jquery", "1");
google.load("jqueryui", "1");
google.load("maps", "3", {other_params: "language=ru&sensor=false"});
google.setOnLoadCallback(function() {
// ...
$("#comments").dataTable({
"bJQueryUI": true,
"sPaginationType": "full_numbers",
"aaSorting": [[0, "desc"]]
});
});
不幸的是,這並不工作(這裏an example page) - 該數據表沒有「包裝」表了。
谷歌瀏覽器控制檯的錯誤信息是:
jquery.dataTables.min.js:151
Uncaught ReferenceError: jQuery is not defined
是否有人請有一個想法,我做錯了嗎?
我問at the DataTables.net forum太...
UPDATE:
我已經從我的服務器,以微軟的CDN本地託管dataTables.net文件交換,因爲它不會改變任何東西在我的問題(這是我猜:jQuery庫被加載的google.load()的dataTables.net後)