我有以下Ruby代碼:雙的JavaScript對話框提示
<%= link_to "Install", install_game_path(game), :remote => true, :confirm => "Download local content for #{game.name}?", :title => "Install #{game.name}", :id => "game_#{game.id}_install_link" %>
這將產生一行代碼,看起來像這樣: <a href="/games/install/3" data-confirm="Download local content for GAME 1?" data-remote="true" id="game_1_install_link" title="Install GAME 1">Install</a>
然而,在我的開發環境,它是生產兩個Javascript警報提示。我在Firefox中沒有任何Javascript/JQuery錯誤。爲什麼會出現這個對話框兩次(不論是否我點擊 「確定」 或 「取消」
編輯
<%= javascript_include_tag "application" %>
<%= javascript_include_tag 'http://github.com/cowboy/jquery-dotimeout/raw/v1.0/jquery.ba-dotimeout.min.js' %>
產生以下代碼:
<script src="/assets/jquery.js?body=1" type="text/javascript"></script>
<script src="/assets/jquery_ujs.js?body=1" type="text/javascript"></script>
<script src="/assets/games.js?body=1" type="text/javascript"></script>
<script src="/assets/jquery.ba-dotimeout.min.js?body=1" type="text/javascript"></script>
<script src="/assets/pages.js?body=1" type="text/javascript"></script>
<script src="/assets/servers.js?body=1" type="text/javascript"></script>
<script src="/assets/application.js?body=1" type="text/javascript"></script>
<script src="http://github.com/cowboy/jquery-dotimeout/raw/v1.0/jquery.ba-dotimeout.min.js" type="text/javascript"></script>
中的application.js文件僅包含默認內容:
//= require jquery
//= require jquery_ujs
//= require_tree .
你能張貼的JavaScript部分? – DaveB 2013-05-01 18:59:46
這個編輯是否包含你在問@DaveB的問題? – Andy 2013-05-01 20:54:50