gpt4 book ai didi

ruby-on-rails - ajax 请求后无法显示 Twitter Bootstrap 模式

转载 作者:数据小太阳 更新时间:2023-10-29 07:20:00 25 4
gpt4 key购买 nike

我想在点击链接时显示模态窗口,但也想做 ajax 请求以获取需要在模态窗口上显示的对象。

我收到了需要在模态窗口中显示的内容的响应,但它没有作为模态窗口弹出,可能脚本没有被执行。

代码

主页

  <%= link_to "New Topic", "#", :class => 'btn primary float-right bootstrap-popover'   %>
<div id="modal_form_container"></div>

Javascript 代码

   $('a.bootstrap-popover').live('click',  function(){
$(this).unbind('click');

$.ajax({
url: "/topics/new",
type: "GET",
dataType: "html",


complete: function() {
$('loading').hide();
},

success: function(data) {

},

error:function() {
}
}); // End of Ajax

new.js.erb

$('#modal_form_container').html("<%= escape_javascript( render :partial => 'new_form')%>");   
$('#modal_form').modal('show');

这个 new_form 页面包含要在模态窗口上显示的内容

有人可以帮忙吗?

最佳答案

是不是加载元素没有被隐藏?

$('loading').hide();

这不应该是这样的吗:

$('#loading').hide();

关于ruby-on-rails - ajax 请求后无法显示 Twitter Bootstrap 模式,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8475255/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com