在文件准备好后,通过Ajax加载的Rails远程表单没有提交。

时间:2021-08-08 09:38:06

I have a remote form using form_tag and :remote => true that is loaded from a partial. When I load the form through its own view as normal, it works as intended. However, then I try loading the partial on another page through AJAX after document ready. When I try to submit this form, nothing happens. I've tried a regular submit button and calling form.submit().

我有一个使用form_tag的远程表单:remote => true,它是从部分加载的。当我以正常的方式通过它自己的视图加载表单时,它会按预期运行。但是,然后我尝试在准备好文档后通过AJAX将部分加载到另一个页面。当我试图提交这个表格时,什么都没有发生。我尝试了一个常规的提交按钮并调用form.submit()。

Is there some javascript initialization to remote forms that Rails does that I have to duplicate? Or is there something else going on here?

是否有一些javascript对远程表单的初始化,我必须复制这些?或者这里还有别的什么?

1 个解决方案

#1


0  

The only thing that I can think of off the top of my head is the CSRF token left out of the form.

我脑子里唯一能想到的就是表单中漏掉的CSRF令牌。

#1


0  

The only thing that I can think of off the top of my head is the CSRF token left out of the form.

我脑子里唯一能想到的就是表单中漏掉的CSRF令牌。