I m, using jquery-rails gem with javascript_include_tag :defaults
. 因此,该网页有标题:
<script src="/javascripts/jquery.js?1312437063" type="text/javascript"></script>
<script src="/javascripts/jquery_ujs.js?1312437070" type="text/javascript"></script>
<script src="/javascripts/application.js?1311268601" type="text/javascript"></script>
<meta name="csrf-param" content="authenticity_token"/>
<meta name="csrf-token" content="KdgrBxF726xfPP3qbNOHd/0TG9c7lVCoZDXPnadFOzI="/>
Ajax 请求书的行文如下:
<%= link_to Run , :controller => "config_panel", :action => "full_run", :remote => true, :format => :js %>
声明如下:
<a href="/config_panel/full_run.js?remote=true">Run</a>
控制器定义的反应:
def full_run
respond_to do |format|
format.js { render :text => "alert();"}
format.xml
end
end
在被点击时,服务器标识:
Started GET "/config_panel/full_run.js?remote=true"
Processing by ConfigPanelController#full_run as JS
Parameters: {"remote"=>"true"}
Rendered text template (0.0ms)
Completed 200 OK in 1ms (Views: 0.6ms | ActiveRecord: 0.0ms)
浏览器显示平原:
alert();
传真机有<代码>status:200和content-type:text/javascript
。 Chrome·贾科特·科索尔没有错误。
我尝试了以下工作:
- include rails.js --- failed
- change
link_to
to<div onclick="$.ajax(...)">
--- worked
I m 受到<代码>:remote =>的行为的困惑 页: 1