我需要打开远程模态。我的问题是在关闭模态后,在下一次打开它显示相同的内容。 我曾尝试过一些解决方案,但仍未解决。 我怎样才能清除加载/显示之间的模态? 问题的例子是http://jsfiddle.net/NUCgp/2879/
var columns = [{
field: "id",
title: 'ID',
}, {
field: "link",
title: 'LINK'
}];
var data = [{
"id": "1",
"link": "link1"
}, {
"id": "2",
"link": "link2"
}];
function dspInformStatus(value, row, index) {
var rtnVal = '<a class="inform-status" data-remote="http://fiddle.jshell.net/bHmRB/93/show/" data-toggle="modal" data-target="#inform-status' + index + '">' + value + '</a>';
rtnVal += [
'<div class="modal fade" id="inform-status' + index + '" tabindex="-1" role="dialog" aria-labelledby="myModalLabel">',
'<div class="modal-dialog">',
'<div class="modal-content"></div>',
'</div>',
'</div>'
].join("");
return rtnVal;
}
var clickInformStatus = {
'click .inform-status': function(e, value, row, index) {
$(this).siblings("#inform-status" + index).on('hidden.bs.modal', function(event) {
$("#get-random").append("<li>" + $("#random").html() + "</li>");
$(this).removeData('bs.modal'); //noneffective
$(this).data('bs.modal', null); //noneffective
$(this).removeData(); //noneffective
});
}
};
$(function() {
columns[1]["formatter"] = dspInformStatus;
columns[1]["events"] = clickInformStatus;
$('#table').bootstrapTable({
columns: columns,
data: data
});
});
<table id="table">
</table>
<div style="margin-top:150px;">
get random number from remote page --->http://fiddle.jshell.net/bHmRB/93/show/
<br />(shoud be append new number to ul element everytime when click link, but it is wrong now!)
<ul id="get-random" style="width: 200px;height:100px;border: 5px solid #337ab7;">
</ul>
</div>