我正在尝试在托管在 Google Drive 上的 html 中使用 jquery 和数据表。数据表的数据将来自使用内容服务的 Apps 脚本。我正在使用数据表示例。托管的html是:
<title>JQUERY DataTables Page Hosted in Google Drive </title>
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>JQUERY DataTables Page Hosted in Google Drive </title>
<link rel="stylesheet" type="text/css" href="//ajax.aspnetcdn.com/ajax/jquery.dataTables/1.9.4/css/jquery.dataTables.css">
<script type="text/javascript" charset="utf8" src="//ajax.aspnetcdn.com/ajax/jQuery/jquery-1.8.0.min.js"></script>
<script type="text/javascript" charset="utf8" src="//ajax.aspnetcdn.com/ajax/jquery.dataTables/1.9.4/jquery.dataTables.min.js"></script>
<script type="text/javascript" charset="utf8">
$(document).ready( function () {
$('#demo').html( '<table cellpadding="0" cellspacing="0" border="0" class="display" id="example"></table>' );
$('#example').dataTable( {
"bServerSide": false,
"sAjaxSource": "https://script.google.com/macros/s/AKfycbyFGmeMnn2hlRWe1XHTgcOI4nSyi_HcJOYSg2jfBe8b-5qXPUs2/exec"
});
});
</script>
</head>
<body>
<h1>JQUERY DataTables Page Hosted in Google Drive </h1>
<p>Default dataTable with embedded data</p>
<p>Includes sorting, paging and filtering by default.</p>
<p>Entire data table loaded in one hit.</p>
<div id="demo"></div>
</body>
</html>
包含 ready 函数的脚本在http://live.datatables.net/测试工具中运行良好。应用程序脚本发布给任何人,甚至是匿名的。用实际的表替换应用程序脚本调用会导致工作页面。
- 我需要做什么才能使这个工作(可能是跨域问题?)
- 鉴于当前问题的解决方案...对于要提交的数据对域或用户组私有的情况,我应该如何处理身份验证