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 8999965
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T00:15:00+00:00 2026-06-16T00:15:00+00:00

In rails I’ve got a form with remote true in it like so: <%=

  • 0

In rails I’ve got a form with remote true in it like so:

<%= form_for(@thing, :html => { :'data-type' => 'json' },  :remote => true ) do |f| %>

And I’m picking up the ajax event in the javascript with this:

$('#new_thing').bind('ajax:complete', function(json, status, xhr){
        console.log("complete!");
        console.log(json);
        console.log(xhr);
        console.log(status);
});

In the controller I have the line of code to respond to it like this:

respond_to do |format|
  format.json { render :json => @thing }
end

The problem is the console logged return response from the server isn’t a json object, it’s status object and the json response is a text string under the property “responseText” which has been escaped.

How do I get the server to respond with just a json object of the @thing?

Is there something wrong in any of the stages in this?

Thanks!

  • 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-06-16T00:15:01+00:00Added an answer on June 16, 2026 at 12:15 am

    Try parseJSON(json['responseText']) to get JSON object of servers response. I think you should manually bind Ajax call on form submit event, to get JSON object without conversions in success handler of $.ajax() function

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

Sidebar

Related Questions

Rails 2.3.11. I have a search form like this... - form_for(@search) do |form| #
Rails guides show the following example as a generic search form. <%= form_tag(search_path, :method
Rails newb question: Say I'm currently viewing the show.html for one of my classes(
Rails has a .blank? method that will return true if an Object is empty?
(Rails newbie) Hello! I am feeling like I am reusing a lot of my
Rails 3. I installed compass and I started to modify application.html.haml to convert it
Rails introduced some core extensions to Ruby like 3.days.from_now which returns, as you'd expect
Rails gurus: I've just discovered named_scope thanks to another SO user. :) I'd like
Rails -v 3.2.3 im using kaminari to do pagination but i keep getting a
Rails 3.2.2 app, using the most recent shopify gem on github. I've looked at

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.