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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T19:44:06+00:00 2026-06-07T19:44:06+00:00

I’m using a heavy javascript based app that uses a drag and drop feature.

  • 0

I’m using a heavy javascript based app that uses a drag and drop feature.

It works well. But if I add a dynamic object to the page ( which has the exact same attributes and variables as the other objects ), it drags, but on drop, the POST returns a 406.

I’m completely unsure of what could be happening here, as I reinstantiate any environment listeners that could be needed before this call is made. I’ve broken down the call to this:

Where .cranbar is a working pre-existing object. I switch it with an identicaly .foobar which is a dynamically added one, and it returns a 406.

attrs = { _method:"put"};
box = $(".cranbar");
$.post(box.attr('data-update_path'), attrs, function(data) {
});

This snippet comes from the make_droppable method that is loaded after the object is instantiated and before I make an attempt to drag and drop it.

make_droppable: function(){
  $('table#week .day').droppable({
    accept: '.job, .task',
    hoverClass: 'droppable-hover',
    drop: function(e, ui) {
      if (confirmOnDrop){
        if (!confirm('Are you sure?')) {
          if ($('table#week').length > 0) {
            draw_weekly_calendar();
          }
          return false;
        }
      }

      var box = $(ui.draggable);
      // var old_container = box.parents('td:first');
      var new_cell = $(this);
      var new_container = $(this).find('.rel_box');

      // add indicator
      box.addClass('indicator');

      // add box to new container
      box.attr('style', 'position: absolute;').appendTo(new_container);

      var attrs = null;

      if (box.attr('data-object-type') == 'job') {
        // update job already on screen
        attrs = {
          'job[scheduled_on]': new_cell.attr('data-scheduled_on'),
          '_method': 'put'
        }
      }
      else if  (box.attr('data-object-type') == 'task') {
        attrs = {
          'task[scheduled_at]': new_cell.attr('data-scheduled_on'),
          '_method': 'put'
        }
      }

      if (attrs) {
        $.v = attrs;
        $.post(box.attr('data-update_path'), attrs, function(data) {
          box.removeClass('indicator');
          box.attr('data-scheduled_at', new_cell.attr('data-scheduled_on'));
          draw_weekly_calendar();
        });
      }

      // nice effect
      box.effect('shake', { times: 1, distance: 2 }, 50);
    }
  });      
},

Does anyone know what I can do to find the source of this 406?

UpdatE

This probably has a lot to do with it. But I’m comparing headers now.

Failing Post :

Response Headers
Cache-Control   no-cache
Connection  Keep-Alive
Content-Length  1
Content-Type    text/html; charset=utf-8
Date    Mon, 09 Jul 2012 16:11:27 GMT
Server  WEBrick/1.3.1 (Ruby/1.9.2/2011-02-18)

Request Headers
Accept  text/javascript
Accept-Encoding gzip, deflate
Accept-Language en-us,en;q=0.8,es-es;q=0.5,es;q=0.3
Connection  keep-alive
Content-Length  57
Content-Type    application/x-www-form-urlencoded; charset=UTF-8

Successful Post:

Response Headers
Cache-Control   max-age=0, private, must-revalidate
Connection  Keep-Alive
Content-Length  2024
Content-Type    application/json; charset=utf-8
Date    Mon, 09 Jul 2012 16:11:35 GMT
Etag    "93432c11e3cc55dfec8e0aee7c08bcc1"
Server  WEBrick/1.3.1 (Ruby/1.9.2/2011-02-18)

Request Headers
Accept  text/javascript
Accept-Encoding gzip, deflate
Accept-Language en-us,en;q=0.8,es-es;q=0.5,es;q=0.3
Connection  keep-alive
Content-Length  57
Content-Type    application/x-www-form-urlencoded; charset=UTF-8
  • 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-07T19:44:08+00:00Added an answer on June 7, 2026 at 7:44 pm

    Seems to me that the issue is the Content-Type of the resposne header. It’s using text/html, but expects application/json. This causes a 406 error because, although the data was successfuly queried, it’s not a response that’s valid -> 406. I honestly don’t know if you can change the contentType with inthe $.post params, but you can do it with .ajax().

    $.ajax({ 
      type: 'POST', 
      url: box.attr('data-update_path'), 
      contentType: 'application/json; charset=utf-8', 
      data: attrs,
      success: function(data){ 
        box.removeClass('indicator');
        box.attr('data-scheduled_at', new_cell.attr('data-scheduled_on'));
        draw_weekly_calendar();
      }
    });
    

    Hopefully this resolves your problem.

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

Sidebar

Related Questions

That's pretty much it. I'm using Nokogiri to scrape a web page what has
I am reading a book about Javascript and jQuery and using one of the
I have a French site that I want to parse, but am running into
We're building an app, our first using Rails 3, and we're having to build
I'm parsing an RSS feed that has an ’ in it. SimpleXML turns this
I am using Paperclip to handle profile photo uploads in my app. They upload
I'm new to using the Perl treebuilder module for HTML parsing and can't figure
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I want to count how many characters a certain string has in PHP, but
I used javascript for loading a picture on my website depending on which small

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.