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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T18:43:08+00:00 2026-06-17T18:43:08+00:00

I’m using the Handsontable jquery plugin to change cells in a datagrid. Handsontable sends

  • 0

I’m using the Handsontable jquery plugin to change cells in a datagrid. Handsontable sends the data in an array as such:

var change = [['Z', null, 'X']]

I then pass this data to the server using ajax:

$.ajax({
  url: "/incomes",
  dataType: "text",
  type: "POST",
  data: { data: change },
});

The problem is that with a null value ajax will ignore this value and change the array, like such:

change[0][0]    Z
change[0][1]    
change[0][2]    X

Because this value in the array is null, Webrick throws the following error:
Internal Server Error
expected Hash (got Array) for param 0

I’m really hoping to avoid looping through the data (there are multiple arrays in a real example) and changing any of these null values. Is there an easier way to ensure that data can be sent to the server without erring out?

HTML Error:

Internal Server Error


expected Hash (got Array) for param `0′

WEBrick/1.3.1 (Ruby/1.9.3/2012-11-10) at
localhost:3000

Terminal Error:

ERROR TypeError: expected Hash (got Array) for param `0'
    /home/g/.rvm/gems/ruby-1.9.3-p327/gems/rack-1.4.4/lib/rack/utils.rb:127:in `normalize_params'
    /home/g/.rvm/gems/ruby-1.9.3-p327/gems/rack-1.4.4/lib/rack/utils.rb:128:in `normalize_params'
    /home/g/.rvm/gems/ruby-1.9.3-p327/gems/rack-1.4.4/lib/rack/utils.rb:96:in `block in parse_nested_query'
    /home/g/.rvm/gems/ruby-1.9.3-p327/gems/rack-1.4.4/lib/rack/utils.rb:93:in `each'
    /home/g/.rvm/gems/ruby-1.9.3-p327/gems/rack-1.4.4/lib/rack/utils.rb:93:in `parse_nested_query'
    /home/g/.rvm/gems/ruby-1.9.3-p327/gems/rack-1.4.4/lib/rack/request.rb:332:in `parse_query'
    /home/g/.rvm/gems/ruby-1.9.3-p327/gems/rack-1.4.4/lib/rack/request.rb:209:in `POST'
    /home/g/.rvm/gems/ruby-1.9.3-p327/gems/rack-1.4.4/lib/rack/methodoverride.rb:26:in `method_override'
    /home/g/.rvm/gems/ruby-1.9.3-p327/gems/rack-1.4.4/lib/rack/methodoverride.rb:14:in `call'
    /home/g/.rvm/gems/ruby-1.9.3-p327/gems/rack-1.4.4/lib/rack/runtime.rb:17:in `call'
    /home/g/.rvm/gems/ruby-1.9.3-p327/gems/activesupport-3.2.9/lib/active_support/cache/strategy/local_cache.rb:72:in `call'
    /home/g/.rvm/gems/ruby-1.9.3-p327/gems/rack-1.4.4/lib/rack/lock.rb:15:in `call'
    /home/g/.rvm/gems/ruby-1.9.3-p327/gems/actionpack-3.2.9/lib/action_dispatch/middleware/static.rb:62:in `call'
    /home/g/.rvm/gems/ruby-1.9.3-p327/gems/railties-3.2.9/lib/rails/engine.rb:479:in `call'
    /home/g/.rvm/gems/ruby-1.9.3-p327/gems/railties-3.2.9/lib/rails/application.rb:223:in `call'
    /home/g/.rvm/gems/ruby-1.9.3-p327/gems/rack-1.4.4/lib/rack/content_length.rb:14:in `call'
    /home/g/.rvm/gems/ruby-1.9.3-p327/gems/railties-3.2.9/lib/rails/rack/log_tailer.rb:17:in `call'
    /home/g/.rvm/gems/ruby-1.9.3-p327/gems/rack-1.4.4/lib/rack/handler/webrick.rb:59:in `service'
    /home/g/.rvm/rubies/ruby-1.9.3-p327/lib/ruby/1.9.1/webrick/httpserver.rb:138:in `service'
    /home/g/.rvm/rubies/ruby-1.9.3-p327/lib/ruby/1.9.1/webrick/httpserver.rb:94:in `run'
    /home/g/.rvm/rubies/ruby-1.9.3-p327/lib/ruby/1.9.1/webrick/server.rb:191:in `block in start_thread'
  • 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-17T18:43:10+00:00Added an answer on June 17, 2026 at 6:43 pm

    This is a stab in the dark, but you might try doing your POST with JSON or some other content type:

    $.ajax({
      url: "/incomes",
      dataType: "text",
      type: "POST",
      data: JSON.stringify({ data: change }),
      contentType: 'application/json'
    });
    

    I suggest this as a solution because the JSON format can represent null values and nested arrays more naturally (IMO) than the default x-www-form-urlencoded format.

    How this Works

    JSON.stringify will make sure your data are serialized as JSON. Using the contentType setting like this will cause the Content-Type header to ‘application/json’ in the HTTP request. Rails uses this as a clue to interpret the incoming POST body as JSON.

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

Sidebar

Related Questions

I am using jsonparser to parse data and images obtained from json response. When
I am reading a book about Javascript and jQuery and using one of the
I'm new to using the Perl treebuilder module for HTML parsing and can't figure
That's pretty much it. I'm using Nokogiri to scrape a web page what has
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I have a jquery bug and I've been looking for hours now, I can't
I am using JSon response to parse title,date content and thumbnail images and place
I am trying to find ID3V2 tags from MP3 file using jid3lib in Java.
I am confused How to use looping for Json response Array in another Array.
I am using the SimpleRSS gem to parse a WordPress RSS feed. The only

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.