Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/jquery/76.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript 引导模式数据远程不在Chrome中工作_Javascript_Jquery_Html_Css_Twitter Bootstrap - Fatal编程技术网

Javascript 引导模式数据远程不在Chrome中工作

Javascript 引导模式数据远程不在Chrome中工作,javascript,jquery,html,css,twitter-bootstrap,Javascript,Jquery,Html,Css,Twitter Bootstrap,除了Chrome之外,我已经让bootstrap modal data remote为所有浏览器工作。背景显示的是模态本身,而不是模态本身 parentPage.html <a href="#" data-toggle="modal" data-target="#myModal"><img src="images/ball.gif" alt="Add Account"/></a> <div class="modal fade" id="myModal"

除了Chrome之外,我已经让bootstrap modal data remote为所有浏览器工作。背景显示的是模态本身,而不是模态本身

parentPage.html

<a href="#" data-toggle="modal" data-target="#myModal"><img src="images/ball.gif" alt="Add Account"/></a>
<div class="modal fade" id="myModal" tabindex="-1" data-remote="./popups/remotePage.html" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true" data-backdrop="static" data-keyboard="false" >
</div>

remotePage.html

<div class="modal-dialog">
    <div class="modal-content">
      <div class="modal-header">
        Header
      </div>
      <div class="modal-body">
            One fine body...
      </div>
      <div class="modal-footer">Footer
      </div>
    </div><!-- /.modal-content -->
  </div><!-- /.modal-dialog -->

标题
一个好身体。。。
页脚
我已经尝试将data remote放入
标记中


我缺少什么?

请使用此代码。假设您使用的是Twitter Bootstrap 3

parentPage.html

<a href="./popups/remotePage.html" data-toggle="modal" data-target="#myModal"><img src="images/ball.gif" alt="Add Account"/></a>
<div class="modal fade" id="myModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true" data-backdrop="static" data-keyboard="false" >
<div class="modal-dialog">
    <div class="modal-content">
    </div>
</div>
</div>
<div class="modal-header">Header</div>
<div class="modal-body">
    One fine body...
</div>
<div class="modal-footer">Footer</div>

更新 根据对答案的评论,Google Chrome不允许将XMLHttpRequest从文件协议(
文件://
)作为安全措施。你有两个选择

一种是将文件托管在HTTP服务器中。如果您使用的是Windows,请使用WAMP或XAMPP

第二个选项是在Chrome中禁用web安全模式,但不建议这样做

chrome.exe --disable-web-security

供您参考:

是的,我正在使用twitter bootstrap 3。我仍然得到同样的结果。在FF中工作正常,但在Chrome中不工作。在parentPage.html中对代码进行了小的编辑。另外,按Ctrl+Shift+I检查Google Chrome的Web开发者工具,查看Javascript中是否有错误。XMLHttpRequest无法加载file:///Users/MeLap/Documents/Test/popups/remotePage.html. 请求的资源上不存在“Access Control Allow Origin”标头。因此,不允许访问源“null”。啊,这就解释了。为了安全起见,Google Chrome不允许来自文件协议(
file://
)的XMLHttpRequests。
chrome.exe --disable-web-security