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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T14:22:30+00:00 2026-05-16T14:22:30+00:00

I am getting 406 Not Acceptable error when submitting my form with jQuery. I

  • 0

I am getting 406 Not Acceptable error when submitting my form with jQuery. I have tried the common fix found on the web:

jQuery.ajaxSetup({ 
  'beforeSend': function(xhr) {
    xhr.setRequestHeader("Accept", "text/javascript");
  }
}) 

This hasn’t fixed the problem. request.format outputs text/html. I have been racking my brain all day trying to fix this. Rails 2.3.4, jQuery 1.3.2 and jQTouch.

Here is my jquery code:

jQuery(function () {
  $("#search").submit(function (e) {
    var $form = $(this);
    return app.search($form);
  });
});

var app = {
  search:function ($form) {
    $.ajax({

      type:$form.attr("method"), url:$form.attr("action"),
      dataType:"script", data:$form.serialize(),
      complete:function (req) {
        if (req.status === 200 || req.status === 304) {
        } else {
          alert("There was an error searching. Try again.");
          console.log(this);
        }
      }
    });    
    return false;
  }
};

The form:

  %form{:action => "/search", :method => "post", :id => "search", "accept-charset" => "utf-8"}
    %div{:style =>"margin:0;padding:0;display:inline" }
      %input{:name => "_method", :type => "hidden", :value => "put"}
      %input{:name => "authenticity_token", :type => "hidden", :value => "#{form_authenticity_token}"}
    %ul.rounded
      %li
        %input{:name => 'query', :value => '', :type => 'text', :placeholder => "Search"}

The controller code:

  def show
    query = params[:query]
    @results = Person.search(query)
    respond_to do |wants|
      wants.html { }
      wants.js 
    end   
  end

The show action is the one called. I have verified that, here is the log

Processing PeopleController#show (for 127.0.0.1 at 2010-01-28 14:12:19) [PUT]
  Parameters: {"authenticity_token"=>"y4kC2CZ1dnrV7LWEC2mRxv8mP499C+0HXbRVlDEuWDc=", "query"=>"purcell"}
  SQL (1.3ms)    SELECT trigger_name
 FROM all_triggers
 WHERE owner = 'PDSADMIN'
 AND trigger_name = 'PERSON_PKT'
 AND table_owner = 'PDSADMIN'
 AND table_name = 'PERSON'
 AND status = 'ENABLED'

  Person Columns (20.9ms)    select column_name as name, data_type as sql_type, data_default, nullable,
 decode(data_type, 'NUMBER', data_precision,
 'FLOAT', data_precision,
 'VARCHAR2', decode(char_used, 'C', char_length, data_length),
 'CHAR', decode(char_used, 'C', char_length, data_length),
 null) as limit,
 decode(data_type, 'NUMBER', data_scale, null) as scale
 from all_tab_columns
 where owner = 'PDSADMIN'
 and table_name = 'PERSON'
 order by column_id

  Person Load (3.7ms)   SELECT * FROM person WHERE (person.person_id IN (5554,55,5966,146)) 
Completed in 77ms (View: 20, DB: 26) | 406 Not Acceptable [http://localhost/search]
  • 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-16T14:22:30+00:00Added an answer on May 16, 2026 at 2:22 pm

    The correct way would be to edit (or add) config/initializers/mime_types.rb to accept :iphone requests.

    Mime::Type.register_alias "text/javascript", :iphone
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I keep getting this 406 (Not Acceptable) error when i type in an autocomplete
I am getting this error and I have no idea how to fix it.
I've just moved a site to live and am getting a 406 Not Acceptable
Getting this weird LINQ error. title = System.Linq.Enumerable+WhereSelectEnumerableIterator`2[System.Xml.Linq.XElement,System.String Here is the code I have:
I have the next problem: The specified object was not found in the store.
I'm getting error from devise User does not respond to 'devise' method when running
Getting the following error, which I understand and have seen before. But one thing
Getting an error with my code found HERE ... Which is a culmination of
I have Spring MVC + JAXB web service and Flex client. I am getting
Getting extremely confused with an adminhtml module i'm trying to write! Effectively I have

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.