我有一个函数路data (),它将数据附加到.
$(".modal-content").append("text here");此.被设置为显示:none;
然后我将OnClick添加到元素中,所以当我单击该元素时,它会在.上打开一个模态,并在该模态上显示它的内容。
$(document).on("click", ".element", function() {
// remove the current active element
$(".element").removeClass("active-element");
// add active class on the current element
$(this).addClass("active-element");
curitem = $(this).attr("id");
roadajax(); // assigns content to .modal-content
// showing the current element modal
$(".active-element .modal-content").modal();
});当我点击.element事件处理程序启动,我看到模态!但是没有任何数据,所以我用萤火虫检查了它。
如果我从事件处理程序中删除了.modal()调用,就会发生正常的逻辑,并且.由raodajax()填充,但是如果我重新添加了.modal()调用。roadajax()似乎无法将数据加载到..某种种族状况
我想知道我怎样才能把我的数据显示在模态中。还有别的办法吗?
发布于 2013-11-18 08:20:07
您可以通过放置以下语法来使用直接Ajax模型:
例如:
function roadajax() {
// This is In-built Ajax Functionality Provide by SimpleModel
$('.modal-content').load('http://yoursite.com/page.html').modal();
}这将自动加载您的页面在模型内。
https://stackoverflow.com/questions/20041814
复制相似问题