Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6471345
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T06:12:49+00:00 2026-05-25T06:12:49+00:00

I want to add a Ajax link into my application. When I click on

  • 0

I want to add a Ajax link into my application. When I click on the link it should pop up a modal dialog which contains event’s details..
I add this link in my helper class.

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

Then I create js file to insert content into hidden div.

$('.modal').html(<%= escape_javascript(render(@event)) %>); 
$('.modal').dialog(); 

In here modal is my hidden div. But it could not pop up any modal dialog. I cannot understand what is the error and why is it not working. Plz can anybody help me to correct this?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-25T06:12:49+00:00Added an answer on May 25, 2026 at 6:12 am

    Change

    $('.modal').html(<%= escape_javascript(render(@event)) %>);

    to

    $('.modal').html("<%= escape_javascript(render(@event)) %>");

    From a JS point of view, your code will be invalid because you’re not wrapping your render in quotes and it will try to evaluate your HTML.

    EDIT

    If you’re trying to link to this on a show click, you’ll need to use show.js.erb to show your modal dialog rather than create.js.erb. create will only be called if you POST a form to /events whereas here it looks like you’re trying to show just the details of the event.

    Put the code above (with quotes) in the show.js.erb, make sure you have a respond.js response in your show method on the controller, and try it again.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a simple jsp/servlet application and I want to add AJAX feature to
I am using the AJAX Cascading drop down list but want to add event
I want to add AJax-like transitions to my links if a link opens in
Hey, I want to add a button(link), that when clicked will filter the pagination
I want to add some Ajax sorting options to a list. Since my site
i want to update my ListView with NewsEntries via an Ajax-Link. I have a
I want to add some Ajax -niceness to my Django-coded website. In my Django
I'm trying to add AJAX to my project. I have a link and a
So I have a normal link on my website, and I want to add
I pass parameter with url called var which is containing value 'event'. I want

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.