开发者

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

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

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜