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

  • SEARCH
  • Home
  • 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 6171521
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T23:13:48+00:00 2026-05-23T23:13:48+00:00

I am using Ruby on Rails 3.0.9 and jQuery 1.6.2 I am trying to

  • 0

I am using Ruby on Rails 3.0.9 and jQuery 1.6.2 I am trying to implement an AJAX HTTP request handling JSON data with-in a partial template data rendered.

What I would like to make is render a partial template (performing the rendering process in a controller action and using the render_to_string RoR method, as well) and put the rendered HTML in that JSON data. However, I have some problem on parsing the JSON data with jQuery and I think because in the partial template there are " and ' characters that break the JSON format. In fact, if I render a “simple text” instead of the partial all works.

How can I solve this issue? What do you advice about?

P.S.: I think a similar issue is discussed in this topic…

  • 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-23T23:13:49+00:00Added an answer on May 23, 2026 at 11:13 pm

    It’s not exactly what you’re looking for, but you could use js.erb to update your views dynamically.

    Tell the controller to respond to js format:

    respond_to do |format|
      format.js
    end
    

    create action_name.js.erb in your controller’s view folder similar to this:

    # categories/show.js.erb
    $("#content").html("<%= escape_javascript(render 'categories/_category') %>");
    

    It doesn’t return JSON, instead it returns the complete rendered HTML of your partial. If you need to render a view file (without the leading underscore in the name), you’ll need to pass a :file option and specify the extension of the file.

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

Sidebar

Related Questions

I'm using Ruby on Rails with jQuery and trying to do the following: <%=
I am trying to make a auto complete box using ruby on rails, jquery
I am trying to create a photo viewer in Ruby on Rails using jquery-lightbox
I am using jQuery and Ruby On Rails. I have an ajax call $.get()
I'm trying to write an app using Ruby on Rails and I'm trying to
I was trying to switch the layout using Ruby on Rails but I am
I am using Ruby on Rails and Jquery as my library and 2 plugins
I'm using jQuery's $.post() method to post JSON data, specifically I'm posting an array.
I am using Ruby on Rails 3 and I would like to use jQuery
I am using Ruby on Rails 3.0.9, jQuery 1.6.2 and jQuery UI. I am

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.