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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T11:55:36+00:00 2026-05-26T11:55:36+00:00

Hello I have a form that submits remotely with the jQuery UJS for rails.

  • 0

Hello I have a form that submits remotely with the jQuery UJS for rails. I binded to the beforeSend event to allow me to modify the data submitting to the serve. It’s not working. Here is what I have in the beforeSend:

 settings.data = JSON.stringify({
      'list_item[title]' : 'hi?? there'
 })

This doesn’t work. In the server logs I see this:

Started POST "/lists/9/list_items" for 127.0.0.1 at 2011-10-24 14:04:36 -0700
  Processing by ListItemsController#create as JSON
  Parameters: {"{\"list_item"=>{"title"=>{"\":\"hi?? there\"}"=>nil}}, "list_id"=>"9"}

Any idea what I’m doing wrong? I want to customize the settings.data with added fields that aren’t in the form. 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-05-26T11:55:37+00:00Added an answer on May 26, 2026 at 11:55 am

    You don’t need to stringify anything to put it in settings.data. The data is:

    Data to be sent to the server. It is converted to a query string, if not already a string. It’s appended to the url for GET-requests. […] Object must be Key/Value pairs.

    What you’re doing is putting this string:

    "{"list_item[title]":"hi?? there"}"
    

    into data but that string is not a query string so things are going to get confused. You should be able to simply assign your JavaScript object to settings.data:

    settings.data = { 'list_item[title]' : 'hi?? there' };
    

    and let jQuery sort it out from there.


    Update based on evidence rather than documentation:

    However, further investigation reveals that this doesn’t work. If I send a GET request, any changes I make to settings.data are ignored but if I send a POST request, then changes to settings.data stick but you have to use the query string format to get anything sensible through:

    settings.data = encodeURIComponent('list_item[title]')
                  + '='
                  + encodeURIComponent('hi?? there');
    

    The version of settings.data combined with a POST request gets me this:

    Parameters: {"list_item"=>{"title"=>"hi?? there"}}
    

    on the server and that looks like what you’re after. If you want to preserve some of the original parameters then you’ll have to unpack and repack the query string by hand.

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

Sidebar

Related Questions

I have a Textarea which is in a form that has this value Hello<div
Hello i have a JSP page that contain a form, i want to validate
Hello is it possible to have an ASP.NET MVC form that uses the routes
Hello Stack Overflow i hope you are well today; I have a form that
Hello i have this form filling javascript: function onLine(code,nn) { document.writeform.bericht.value+=code; document.writeform.bericht.focus(); document.writeform.nickname.value+=nn; write1();
Hello i have a list view control, While the form is being loaded i
I have the following form code: # forms.py class SomeForm(forms.Form): hello = forms.CharField(max_length=40) world
Hello I have a form which has two buttons. In the form validation (onsubmit
I have a basic form that I am using as a dummy to test
Hello I have an array that looks like this, Array ( [cfi_title] => Mr

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.