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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T08:01:57+00:00 2026-06-06T08:01:57+00:00

I have a JavaScript app that produces a string. I want to transfer this

  • 0

I have a JavaScript app that produces a string. I want to transfer this string back to my server and assign it to a particular attribute. Apparently AJAX can accomplish this. Unfortunately, I’m a novice with both Rails and AJAX, and I can’t find any clear instructions on how to implement the transfer. Is there a simple, standard way to send a string to a Rails server and assign it to a model attribute?

At the moment, the code is inserted directly in my JavaScript function. It looks like this:

$.ajax({
  type: 'POST',
  url: '/bookcases/'+window.location.href.split('/')[4],
  data: {'_method':'put', 'bookcase[imagemap]':mapcode},
  dataType: 'html',
  success: function() {alert( "Data Saved" );}
});

Firebug gives me a 404 Not Found error. I’ve tinkered with the URL a bit, replacing ‘edit’ with likely candidates like the name of the attribute and POST. I’ve also removed ‘edit’ all together. So far I consistently get the same error. The only exception is when I set the URL to ‘/’, at which point the success message pops up. Unfortunately, the mapcode data has not actually been implanted.

  • 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-06T08:01:58+00:00Added an answer on June 6, 2026 at 8:01 am

    Got it! Apparently, the above code was working just fine. I just needed to add an update method to my controller. For those working through a similar issue, Firefox’s Firebug is invaluable. If you’re encountering an error in JavaScript, Firebug will show you what the cause is. I couldn’t have figured this out without it.

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

Sidebar

Related Questions

I have a web app that is completely contolled with javascript. This means there
I have a javascript/php app and i want to do something that let only
I have some external Javascript files in my GWT app that I only want
I have a facebook app using a lot of Javascript that doesn't work correctly
I have javascript string variable with var sttr=We prefer questions that can be answered
I have a C# ASP.NET app that creates a JavaScript array of values for
I have ZF app that is utilizing a legacy Javascript at for some functionality.
I have a web app that is modular on the back end. I'm trying
I have an interactive JavaScript app that runs through arrays of data. I don't
I have a Delphi 6 app that embeds the Chromium web browser. 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.