2
我有这样的红宝石代码:回调与链接数据的远程=“true”和数据方法=“PUT”
link_to t("general.actions.#{ action }"), [action, @app, item], {
:method => :put,
:remote => true,
:onclick => '$(this).closest("tr").find("td").fadeOut()'
}, :class => 'status'
产生这个网站:
<a href="/apps/guess-the-model/contents/52118140d644363dc4000005/approve"
data-method="put"
data-remote="true"
onclick="$(this).closest("tr").find("td").fadeOut()"
rel="nofollow">
approve
</a>
问题是的,我不应该使用onclick。我应该只在AJAX成功时调用这个js代码,所以我应该通过回调并检查XMLHttpRequest状态。我如何使用:remote => true
和:method= :put
来做到这一点?
我想,你应该在方法的js模板中写入这个js,它被远程链接调用。 –