"MLHttpRequest无法加载文件:///path/to/file.html”;错误
"MLHttpRequest cannot load file: ///path/to/file.html" error
当按下以下jquery load命令时,我正试图在div中加载一个本地html文件。
$("#div_name").load("local_html_file");
但我得到了以下错误。
MLHttpRequest cannot load file:///path/to/file.html. Received an invalid response. Origin 'null' is therefore not allowed access.
我没有运行任何特殊的服务器。只是用Chrome运行我的html文件。我搜索了一下,知道问题是什么,但不知道如何解决。
这就是为什么它在本地不起作用。。。您需要在接受HttpRequest的服务器上运行它。
之前已经讨论过:
- Jquery:在没有Web服务器的情况下本地运行AJAX
- AJAX代码不在本地运行
相关文章:
- 正在使用$location.path(.)路由ng视图
- 节点Js:How to catch a“;没有这样的文件或目录“;读取线模块出错
- jQuery AJAX write to XML
- gulp Iconify任务抛出错误TypeError:Path必须是字符串.收到false
- grep in JQuery to C#
- how to convert html <div> to pdf
- Node.js - POST to iFrame?
- SVG xml to image
- Advantages to DOMParser vs template & innerHTML
- how to split a string with ','
- How to declare a Map containing certain properties with flow
- Php variable obj to js
- 如何在submit to sightly时将表单输入值作为参数传递给WCMUsePojo
- D3JS selectAll to append rect
- Javascript connect to websocket
- paper.js animation along a path
- uglifyjs - symfony assetic dump, path to node
- "MLHttpRequest无法加载文件:///path/to/file.html”;错误
- Grunt在识别失败时发出警告:" warning: Arguments to path.Join必须是字符串
- 什么是jquery正则表达式来匹配这个字符串“http://path/to/file/file-name-123x123