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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T09:17:58+00:00 2026-06-12T09:17:58+00:00

I have a strange problem with droppable. http://jsfiddle.net/samanth/dykcV/16/ This example works very well. Once

  • 0

I have a strange problem with droppable. http://jsfiddle.net/samanth/dykcV/16/ This example works very well. Once I drop a div on the droppable, it does not allow me to drop anything else on that. I have the same piece of code in my application, but the droppable accepts drops.

I have an AJAX call before making a drop. Could this be a problem?

Here is my actual code.

$(".dropItem").droppable({
    accept:'.dragItem',
    hoverClass: 'hovered',

    drop:function (event, ui) {
        var answerNumber = $(this).attr( 'id' );
        var questionNumber = ui.draggable.attr( 'id' );

        $(this).append($(ui.draggable));

        //Send ajax query and get the response here..
        // generating form data

        send('matchAnswer?gameId=' + gameId + '&answerId=' + answerNumber + '&questionId=' + questionNumber, function (e) {
            if (this.status == 200) {
                var resp = this.responseText;
                if ( resp == "true" ) {
                    $(ui.draggable).css ({ position:"relative", top:"0px", left:"0px" }).draggable ("disable").css ({ opacity : 1 });
                    $(this).droppable('option', 'disabled', true);
                } else {
                    // do something here
                }
            }
        }, formData);
    }
});
  • 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-12T09:17:58+00:00Added an answer on June 12, 2026 at 9:17 am

    The Ajax call is the problem. Let’s break down what is happening:

    1. Draggable item gets dropped into a droppable item
    2. Your drop method appends the draggable item into the droppable item
    3. Your drop method then executes an ajax call
    4. When the ajax call completes and the status code is a 200 you do some minor css tweaks and then disable the ability of the droppable from receiving any more draggable items.

    The problem you outlined is that the droppable is allowing more than 1 draggable item to be placed inside of it. Therefore, the problem occurs with the Ajax call. Without being able to test it myself, I would say you are experiencing one of the following problems:


    Your AJAX call is never succeeding

    To check: Open firebug and check the response for your AJAX call


    Your AJAX call is returning with a status code that is NOT 200

    To check: Use firebug to debug the function that gets executed when the AJAX call returns. Is your status code 200?


    this keyword is not referencing the element you think it is

    To check: Use firebug to debug the function that gets executed when the AJAX call returns. What is the value of $(this)?

    If $(this) is not what you think it is, then I believe this javascript code will work for you:

    send('matchAnswer?gameId=' + gameId + '&answerId=' + answerNumber + '&questionId=' + questionNumber,
        $.proxy( function (e) {
        if (this.status == 200) {
            var resp = this.responseText;
            if ( resp == "true" ) {
                $(ui.draggable).css ({ position:"relative", top:"0px", left:"0px" }).draggable ("disable").css ({ opacity : 1 });
                $(this).droppable('option', 'disabled', true);
            } else {
                // do something here
            }
        }
    }, this), formData);
    

    The key in the code above is that I am using $.proxy to ensure that the function that gets executed will keep the correct scope. More information: http://api.jquery.com/jQuery.proxy/

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

Sidebar

Related Questions

I have very strange problem while I am submitting a practice problem on codechef.
I have a strange problem. I do this query in a node.js server using
I have very strange problem specific to IE (confirmed in v8 and v9). When
I have a strange problem using a MapView in Android. It works fine until
I have strange problem with run .exe program in my WebApplication. It works fine
I have this strange problem parsing XML document in PHP loaded via cURL. I
I have strange problem with an MVC3 application. The application works as expected on
I have this strange problem on my web page where if you click below
I have strange problem with disposing entity framework connection in asp.net mvc application. I
I have strange problem. For a project we are using following cloud hosting. http://www.rackspace.com

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.