In assets/javascripts/user.js.coffee
window.install_loader_image = (elem = 'body') ->
$(elem).find('.ajax').click ->
$(this).hide()
$(this).siblings('.loading').show()
$(elem).find('.ajax.modal').ajaxSuccess ->
$(this).show()
$(this).siblings('.loading').hide()
function install_loader_image()
was called for lines below
= link_to 'Edit', edit_employee_path(employee), :remote => true, :class => 'ajax modal edit_link'
.loading{:style => 'display: none;'}
= image_tag 'ajax-loader.gif'
Clicking on link calls edit
action in employees controller
def edit
@employee = Employee.find(params[:id])
end
Then employees/edit.js.erb
file renders and sends to client, and interpreted well in browser. click
function fires, but ajaxSuccess
doesn't. While in Rails 3.0 all was working fine.
How can I make it work?
通过将ajaxSuccess
更改为ajaxComplete
函数来解决问题。
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.