请原谅我对ajax的无知或缺乏知识。
与此数据表相关example供应表"sources/deep.txt"
的文件是否可以是http链接,例如https://www.dropbox.com/s/380w6wafrecozqg/deep.txt
?或者它必须是同一服务器中某处的文件,例如../someOther/Directory/nearby/deep.txt
$(document).ready(function() {
var oTable = $('#example').dataTable( {
"bProcessing": true,
"sAjaxSource": "sources/deep.txt",
//would this work?
//"sAjaxSource": "https://www.dropbox.com/s/380w6wafrecozqg/deep.txt",
"aoColumns": [
{ "mDataProp": "engine" },
{ "mDataProp": "browser" },
{ "mDataProp": "platform.inner" },
{ "mDataProp": "platform.details.0" },
{ "mDataProp": "platform.details.1" }
]
} );
} );
答案 0 :(得分:2)
是的,它可以在另一台服务器上,具体取决于具体情况。这被称为跨源请求。
您从中请求数据的服务器必须允许该请求。它通过CORS执行此操作。典型的许可标题将是:
Access-Control-Allow-Origin: *