jquery - Add a modal dialog into Rails? -


I want to add an Ajax link to my application. When I click on the link, it should pop up a modal dialog, which details the event. I add this link to my assistant category.

  link_to (event.name, events_path (@event): remote => true   

Then to insert content in a hidden div I create a JS file.

  $ ('modal') .HTML (& lt;% = Escape_javascript (render (%);% & gt;); $ ('.modal'). Dialog ();   

The modal is my hidden div here but it is not able to pop up any of the model dialogues. I can not understand what the error is and it Why is not it working? Can someone help me to correct me?

change

$ ('modal'). Html (& lt;% = escape_javascript (render (@vent))% & gt;);

$ ('modal') .html ("& lt;% = Escape_javascript (render)%>))

By seeing the JS point, your code will be invalid because you do not wrap your render in the quote and it will evaluate your HTML

Edit

If you are trying to link it to show click, you will Enter your code To do this, use show.js.erb for the modal dialog instead of create.js.erb . Creating will only be called if you can see the POST form as a / event , while it seems that you can just The event is trying to show the incident. Keep the code above (with quotation marks) in

show.js.erb , make sure that you have a response.js response on the controller show method, and try it again.

Comments

Popular posts from this blog

mysql - BLOB/TEXT column 'value' used in key specification without a key length -

memcached - Django cache performance -