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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T18:47:46+00:00 2026-06-09T18:47:46+00:00

I have this jquery snippet. Since it is not passing me the value, I

  • 0

I have this jquery snippet. Since it is not passing me the value, I am going into all sort of ways to figure out why, including function call backs to see what is going on. Yet nothing gets displayed. Two different examples

<script src="http://code.jquery.com/jquery-latest.js"></script>
<script type="text/javascript">
//jquery code for source list
$(document).ready(function()
     {
      $('#country').change(function() 
         {
            if ($(this).val()!='') 
              {
                $("#source").load("/CI-3/application/controllers/control_form.php",   {pais_id: $(this).val()}, function() 
            {
          alert('Load was not performed.'));
            }

    });

});  // end of country and city function
</script>

So this is the selectlist that should activate the jquery upon changing value:

<?php echo form_open('control_form/add_all'); ?>
       <label for="country">Country<span class="red"></span></label>
        <select id="country" name="country">
            <option value="">Select</option>
            <?php

                foreach($result as $row)
                {
                echo '<option value="' . $row->pais_id . '">' . $row->pais_name . '</option>';
                }

            ?>
        </select>

And a different example:

<!DOCTYPE html>
<html>
<head>
<script src="http://code.jquery.com/jquery-latest.js"></script>
<script type="text/javascript">
$(document).ready(function()
        {
             $('#country').change(function() 
                  {
                  if ($(this).val()!='') 
                      {
                               $("#loquesea").load("/not-here.php", function(response, status, xhr) 
                                    {
                                if (status == "error") 
                                      {
                                          var msg = "Sorry but there was an error: ";
                                          $("#error").html(msg + xhr.status + " " + xhr.statusText);
                                          }
                                });


                         });
                  });

                 });



</script>
</head>
<body>
<b>Successful Response (should be blank):</b>
<div id="success"></div>
<b>Error Response:</b>
<div id="error"></div>


<form action="">
<select id = "country" name="country">
<option value="volvo">Volvo</option>
<option value="saab">Saab</option>
<option value="fiat">Fiat</option>
<option value="audi">Audi</option>
</select>
</form>
</body>
  • 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-09T18:47:47+00:00Added an answer on June 9, 2026 at 6:47 pm

    There is not element in your html with id source so your selector will $("#source")

    Change

    $("#source")
    

    to

    $("#success")
    

    There is } bracket was missing for if ($(this).val() != ''){

    $(document).ready(function() {
        $('#country').change(function() {
            if ($(this).val() != '') {
                $("#loquesea").load("/not-here.php", function(response, status, xhr) {
                    if (status == "error") {
                        var msg = "Sorry but there was an error: ";
                        $("#error").html(msg + xhr.status + " " + xhr.statusText);
                    }
                });
            }
    
            });
        });
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

basically i have this click function in jquery: (this is just a snippet, not
I have this jQuery snippet, I have stored the variables to highlight them. var
I have this jQuery snippet: $(function() { $(ul > li).hover(function() { $(this).find(ul).stop(true, true).animate({opacity: 'toggle'},
I have this snippet of code (AJAX) in jQuery. $.get('someScript.php?lat=' + clickedLatLng.lat() + '&lon='
I have this snippet of jQuery used to get an ID number from an
I have this jQuery object which I need to pull into a function, is
I have this little snippet in jQuery $('.cake_checkboxes').click(function(){ $(this).nextAll('.quantity').first().slideToggle(); }); here is my html
I have this snippet of code that looks for the value in a select
I have a snippet of JQuery code that do some bar scrolling. Since I
I have this jquery function that works, except I need to add something. 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.