Rails 关于 Rails 中的 Ajax

ecloud · 2018年03月01日 · 最后由 ecloud 回复于 2018年03月02日 · 1520 次阅读

我在模版中写了一个发送 Ajax 的链接

<%= link_to 'Destroy', user_path(@user), method: :delete, remote: true %>

然后 coffee 中这样写的

$("a[data-remote]").on "ajax:success", (e, data, status, xhr) ->
        console.log e["detail"][0]

我在 coffee 代码中打印的 data, status 和 xhr 都是 undefined,要获取服务器返回的 json 只能通过 e["detail"][0],请问还有其他方式更方便的获取返回的数据吗?

需要 登录 后方可回复, 如果你还没有账号请 注册新账号