开发者

Remote scripts aren't able to close modal dialog in Rails 3

开发者 https://www.devze.com 2023-03-04 15:10 出处:网络
When a user clicks a link I call: $(\"#myform\").modal(); to show a modal form. The form gets submitted remotely to invoke the create method on my controller. I display create.js.erb in which I cal

When a user clicks a link I call:

$("#myform").modal();

to show a modal form. The form gets submitted remotely to invoke the create method on my controller. I display create.js.erb in which I call:

$.modal.close();

But this fails to close the modal window. For whatever reason $.modal isn't available at that point.

I've worked around this by setting:

window.modal=$("#myform").modal()

and then, in create.js.erb I ca开发者_C百科ll:

window.modal.close();

But this isn't a great solution. I'd really like to be able to just call $.modal.close(). Is there any reason I can't? Could this just be added to SimpleModal?

0

精彩评论

暂无评论...
验证码 换一张
取 消