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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T21:14:49+00:00 2026-05-24T21:14:49+00:00

I’m not a jquery expert, so I need some help here on this existing

  • 0

I’m not a jquery expert, so I need some help here on this existing code.

I want my jquery ajax function to work when #drop2 AND #drop2_1 have been changed.
Right now the function only works when #drop2 OR #drop2_1 are changed. 🙁

Jquery:

$('#wait_2').hide();
$('#drop_2 && #drop_2-1').change(function(){
  $('#wait_2').show();
  $('#result_2').hide();
  $.get(\"func.php\", {
    func: \"drop_2\",
    drop_var: $('#drop_2').val()
  }, function(response){
    $('#result_2').fadeOut();
    setTimeout(\"finishAjax_tier_three('result_2', '\"+escape(response)+\"')\", 400);
  });
    return false;
});

PHP code:

if($_GET['func'] == "drop_1" && isset($_GET['func'])) {
   drop_1($_GET['drop_var']);
}

function drop_1($drop_var)
{
    include_once('db.php');
    $result = mysql_query("SELECT DISTINCT tier_two FROM Producten_verkoop WHERE tier_one='$drop_var'");
    $result2 = mysql_query("SELECT DISTINCT tier_three FROM Producten_verkoop WHERE tier_one='$drop_var'")

    or die(mysql_error());

    echo '<select name="drop_2" id="drop_2">
          <option value=" " disabled="disabled" selected="selected">Choose one</option>';

           while($drop_2 = mysql_fetch_array( $result ))
            {
              echo '<option value="'.$drop_2['tier_two'].'">'.$drop_2['tier_two'].'</option>';
            }

    echo '</select>';


            echo '<select name="drop_2-1" id="drop_2-1">
          <option value=" " disabled="disabled" selected="selected">Choose one</option>';

           while($drop_2 = mysql_fetch_array( $result2 ))
            {
              echo '<option value="'.$drop_2['tier_three'].'">'.$drop_2['tier_three'].'</option>';
            }

    echo '</select>';

Other solutions, like detecting non-empty values are also welcome.

  • 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-24T21:14:49+00:00Added an answer on May 24, 2026 at 9:14 pm

    The selector which you provided is not going to work. You have to write a custom logic to implement your logic. Try this

    function getFunc(){
    
      //Reset the dropdownChanged values
      dropDown2_1Changed = false;
      dropDown2Changed = false;
    
      $('#wait_2').show();
      $('#result_2').hide();
      $.get("func.php", {
          func: "drop_2",
          drop_var: $('#drop_2').val()
        }, 
        function(response){
          $('#result_2').fadeOut();
          setTimeout(function(){
            finishAjax_tier_three('result_2', escape(response));
          }, 400);
      });
    }
    
    var dropDown2Changed = false; dropDown2_1Changed = false;
    
    $('#drop_2').change(function(){
       dropDown2Changed = true;
       if(dropDown2_1Changed){
          getFunc();
       }
    });
    
    $('#drop_2-1').change(function(){
       dropDown2_1Changed = true;
       if(dropDown2Changed){
          getFunc();
       }
    });
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I need a function that will clean a strings' special characters. I do NOT
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
For some reason, after submitting a string like this Jack’s Spindle from a text
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
I have this code: - (void)parser:(NSXMLParser *)parser foundCDATA:(NSData *)CDATABlock { NSString *someString = [[NSString
I want to construct a data frame in an Rcpp function, but when I
I have some data like this: 1 2 3 4 5 9 2 6
I have just tried to save a simple *.rtf file with some websites and
I want to count how many characters a certain string has in PHP, but
link Im having trouble converting the html entites into html characters, (&# 8217;) i

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.