【问题标题】:Append div to another div (CoffeeScript)将 div 附加到另一个 div (CoffeeScript)
【发布时间】:2018-11-30 12:06:34
【问题描述】:

我的 div 有错误

  <div data-role="dialog" id="step_2_ajax_error">
  <div data-role="header" data-id="persistent" data-position="fixed">
    <div class="mini_logo"><a href="/" data-ajax="false"><%= image_tag "#{image_folder}/logo.png", fetch_format: :auto %></a></div>
  </div>
  <div role="main" class="ui-content" style="background-color: #ececec;">
    <%= _('Tyvärr bekräftades inte era platser. Gör vänligen en ny sökning.') %>
    <br/>
    <a href="#" data-rel="back" class="ui-btn ui-shadow ui-corner-all ui-btn-a"><%= _('Stäng') %></a>
  </div>
</div>

我需要通过 coffeescript 将它加载到另一个 div

这里是

    <div data-role="popup" id="step_2_error" data-overlay-theme="b" data-theme="b" data-dismissible="false" tabindex="0" class="ui-page ui-page-theme-b">
  <div data-role="header" data-id="persistent" data-position="fixed">
    <div class="mini_logo"><a href="/" data-ajax="false"><%= image_tag "#{image_folder}/logo.png", fetch_format: :auto %></a></div>
  </div>
  <div role="main" class="ui-content" id="step_2_error_content">
  </div>
</div>

这是我尝试的方法

showAjaxErrorScreen = () ->
$('#step_2_error_content').load("#step_2_ajax_error")
$.mobile.changePage '#step_2_error', changeHash: false
log_event "Show ajax error screen"
Honeybadger.notify raiseError('Ajax not OK on step_2', 'NOT OK')

但它只是打开空白屏幕。并且不加载错误 div。

我该如何解决?

【问题讨论】:

    标签: javascript html css coffeescript


    【解决方案1】:

    我找到了答案。

    我能够像这样运行它

    $.mobile.changePage '#step_2_ajax_error', changeHash: false
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2023-03-20
      • 1970-01-01
      • 2016-11-05
      • 2020-11-05
      相关资源
      最近更新 更多