gpt4 book ai didi

javascript - 数据表,意外标记非法

转载 作者:行者123 更新时间:2023-12-02 18:22:45 27 4
gpt4 key购买 nike

我的数据表有问题。下面的代码在包含在 html 文档中的脚本标记中时有效。如果代码是从外部文件加载的,浏览器会提示“意外的 token ”

var oTable = $('#tbFilmes').dataTable({
'bProcessing': true,
'sAjaxSource': 'filme/ajaxBuscarFilme',
'sServerMethod': 'POST',
'aoColumns': [
{ "sTitle": "Id"},
{ "sTitle": "Name"},
{ "sTitle": "Year"}
]
});

检查服务器返回的 js 文件,显示文件中附加了非 ASCII 字符,如下所示。

js Source Code https://www.dropbox.com/s/vxjbepd3kdde7zg/erroJs.jpg

最佳答案

问题出在 apache 中。

我取消了 httpd.conf 中一行的注释,它解决了问题。我找到了答案here

You need to disable following two options:

  • EnableMMAP - This directive controls whether the httpd may use memory-mapping if it needs to read the contents of a file during delivery. By default, when the handling of a request requires access to the data within a file -- for example, when delivering a server-parsed file using mod_include -- Apache memory-maps the file if the OS supports it.

  • EnableSendfile - This directive controls whether httpd may use the sendfile support from the kernel to transmit file contents to the client. By default, when the handling of a request requires no access to the data within a file -- for example, when delivering a static file -- Apache uses sendfile to deliver the file contents without ever reading the file if the OS supports it.

However, these two directives are known to have problem with a network-mounted DocumentRoot (e.g., NFS or SMB), the kernel may be unable to serve the network file through its own cache. So just open httpd.conf on all boxes and changes the following:

EnableMMAP off
EnableSendfile off

Just restart the web server and voila!

# service httpd restart

关于javascript - 数据表,意外标记非法,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18685227/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com