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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T23:39:49+00:00 2026-05-27T23:39:49+00:00

I have a select menu that has multiple select enabled. I have a click

  • 0

I have a select menu that has multiple select enabled. I have a click event handler set for the submit button, so that jQuery loops through each drop down value selected and makes an ajax call. It works fine, except for the very last value; the last value in the list never seems to make it to the ajax call, and if only one item is selected, then there doesn’t seem to any action. Any help would be greatly appreciated.

Here is my code:

$("#add_members").click(function () {
    var members = $("#project_members").val();

    jQuery.each(members, function () {
        var projectid = <? php echo $project_id; ?> ;
        var member = this[0];

        $.post([url], {
            project_id: projectid,
            user_id: member
        }, function (data) {
            alert(data);
        });
    });

    location.reload();
});
  • 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-27T23:39:50+00:00Added an answer on May 27, 2026 at 11:39 pm

    I agree with the others that you most likely have a race condition going on. Your location.reload gets called directly after you last post and is most likely cancelling your ajax.

    Try setting your ajax to not be asynchronous by using $.ajaxSetup

        jQuery.ajaxSetup({async: false});   //set to false for this method
    
        $.post([url], {
            project_id: projectid,
                user_id: member
            }, function (data) {
                alert(data);
        });
    
        jQuery.ajaxSetup({async: true});   //Change it back when done if you so desire
    

    This should end your race condition.

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

Sidebar

Related Questions

I have a form that has a select menu(A) and 2 divs (B and
I have a select element that functions as a dropdown menu. Each option has
I have a simple html option/select (dropdown) menu. I want to use JQuery to
I have a form that has a dropdown menu i need the user to
I need to have a drop-down menu that allows you to select a year
I'm building a Zend form that has a dropdown/select menu populated with data from
Say I have a form_for with a select menu to assign a User on
I have a little dropdown menu similar <select> , which contolled from external js-function.
I have a column called menu_order which has no default value. When I select
I have select values as follows: <select id=SelectBox multiple=multiple> <% foreach (var item in

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.