我正在尝试通过ajax在bootstrap模式中加载一个url,当模态被聚焦但是它不起作用。
模态代码
<button type="button" class="btn btn-primary btn-lg" data-toggle="modal" id="loadMediaFiles" data-target="#myMediaModal">Launch demo modal</button>
<div class="modal fade" id="myMediaModal">
<div class="modal-dialog" role="document">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button>
<h4 class="modal-title" id="myModalLabel">Media</h4>
</div>
<div class="modal-body" id="mediaFilesResult">
<div class="text-center">
<i class="fa fa-circle-o-notch fa-spin fa-3x fa-fw"></i>
</div>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
</div>
</div>
的Javascript
$('#loadMediaFiles').focus(function () {
$.ajax({
url: '/Uploads/Browse',
contentType: 'application/html; charset=utf-8',
type: 'GET',
dataType: 'html'
})
.success(function (result) {
$('#mediaFilesResult').html(result);
})
});
我做错了什么,我需要帮助。感谢