Rails - Ajax在生产服务器上无法正常工作

时间:2015-06-08 22:55:02

标签: javascript jquery ruby-on-rails ruby ajax

我的Ruby on Rails应用程序中存在一个非常奇怪的问题。我有一些看起来像这样的控制器:

class ReportsController < ApplicationController
  include ActionController::Live
  #rest of the code

  def get_password
    @password = @report.password
  end
end

在我看来,我有这段代码:

%small{id: "report_password_#{report.id}"}
  %span= link_to '[Show Password]', get_password_report_path(report), remote: true

我也有非常简单的get_password.js.erb文件:

$("#report_password_<%=@report.id %>").html('<%= @password %>')

现在问题是在localhost上一切正常但是在我点击链接显示密码后部署到生产时它有时会工作,有时候不行......

当我在链接上快速点击2次时,它会显示密码。当我点击链接应用程序发送正确的ajax请求并得到正确的响应,但没有用密码正确更新div。

您有任何想法如何解决这个问题吗?

0 个答案:

没有答案