Wednesday, May 18, 2022

[FIXED] How to render a partial on button-click in rails using javascript and not by using a method in controller?

Issue

I have a issue where I need to render a partial on a button click say do u really want to perfrom the action and it has to be done by using only javascript, adding a method in the controller and thereby rendering the partial is not preferable.


Solution

Simply load the partial and just hide it with CSS using display:none and when the users clicks on the button show him the confirm dialog and change the CSS of the partial from none to block and you are done



Answered By - Shreyas Agarwal
Answer Checked By - Terry (PHPFixing Volunteer)

No comments:

Post a Comment

Note: Only a member of this blog may post a comment.