title: Jquery/AJAX function not working onChange Event
body: <p>I am trying to populate a dropdown menu on behalf of the value of an other dropdown. the problem here is that the function i am trying to call in select tag's onChange event is not being compiled. and an error is appearing in console.enter code here.
  HTML:</p>
  
  <pre><code>&lt;select name="street_id" id="street_id" onchange="get_data(this)" class="input-xlarge"&gt;
  
  &lt;/select&gt;
  </code></pre>
  
  <p>Jquery:</p>
  
  <pre><code>&lt;script type="text/javascript"&gt;
      function get_data()
      {    
          $('#client_list').empty()    
          var dropDown = document.getElementById("street_id");
          var street_id = dropDown.options[dropDown.selectedIndex].value;
          $.ajax({
                  type: "GET",
                  url: "http://localhost:7777//index.php/admin/get_one_street_client/" + street_id,            
                  data: { 'street_id': street_id },
                  success: function(data){
                      // Parse the returned json data               
                      var opts = $.parseJSON(data);
                      // Use jQuery's each to iterate over the opts value
                      $.each(opts, function(i,d) {
                          console.log(d.client_name);
                          // You will need to alter the below to get the right values from your json object.  Guessing that d.id / d.modelName are columns in your carModels data
                          &lt;?print "var value == '$balance_data[0]-&gt;client_id'";
                          //$selected = 'selected';
                          ?&gt;
                          $('#client_list').append('&lt;option value="' + d.client_id + ' "&gt;' + d.client_name + '&lt;/option&gt;');                    
                      });
  
                  }
  
            });
      }
  &lt;/script&gt;
  </code></pre>
  
  <p>Error:</p>
  
  <p>insert_balance:180 </p>
  
  <blockquote>
    <p>Uncaught ReferenceError: get_data is not definedonchange @
    insert_balance:180</p>
  </blockquote>
  
  <p>i have already added the jquery library address on top.</p>
  
  <pre><code>&lt;script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js"&gt;&lt;/script&gt;
  </code></pre>