Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

关于在“在 Rails 中使用 JavaScript”中第4小节的反馈 #89

Open
don369 opened this issue Jul 3, 2017 · 3 comments
Open

Comments

@don369
Copy link

don369 commented Jul 3, 2017

在第4小节"处理 Ajax 事件" 中 "ajax:success"事件的参数是[ xhr, status, err ],而在jquery-ujs的wiki中的参数是[ data, status, xhr ]。谢谢查看!
Custom events fired during "data-remote" requests

@chloerei
Copy link
Member

chloerei commented Jul 3, 2017

看了新旧两班 rails.js 源码之后,我觉得 jquery-ujs wiki 的是对的

https://github.com/rails/jquery-ujs/blob/4849eca8ff76a0a2a83a8ff4d5cefef2c2fa3cb4/src/rails.js#L156-L158
https://github.com/rails/rails/blob/4b29d9f1db0dd8fc95829cfefed0687242cfc12b/actionview/app/assets/javascripts/rails-ujs/utils/ajax.coffee#L19

rails guides 里面错了,不过英文原文就错了。

晚点再处理。

@chloerei
Copy link
Member

chloerei commented Jul 8, 2017

发现官方多了一段 Rails 5.1 的 event 描述还没发布 https://github.com/rails/rails/blob/98f8f81879825a009b0c751b3178fcb687e3033a/guides/source/working_with_javascript_in_rails.md#rails-ujs-event-handlers

我也晕了,应该以实测为准。

@don369
Copy link
Author

don369 commented Jul 10, 2017

对,我本以为是jquery版本造成的(我用的是 v1.12.4,本想下载个1.8.x来测试一下再给你反馈,不过一直没时间)。data, status, xhr的是获取不了参数,而如你所发链接里的event.detail来获取[data, status, xhr];

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants