This code does not work with latest jQuery
<p>I am using some code from <a href="http://phpcode.hu/teszt/jquery_select/" rel="nofollow">http://phpcode.hu/teszt/jquery_select/</a></p>

<p><strong>Seemingly I didnt add enough information, hence this question is getting voted down, faster than celine dion singing on the titanic.</strong></p>

<p>Ok The php code below ( is just for posterity ) all code for this script is included below , nothing more or less - aside from the actual db connection which has bugger all to do with it.</p>

<p>Steps: running this is jquery 1.2.3 the code runs absolutely fine.
Anything after that build and we get zilch in the secondary select field ( <strong>Cities</strong> )</p>

<p>Running in latest jQuery build: using firebug on FF 10.</p>

<p>If we make a state selection, the cities selection does not propagate. However if we inspect the eleemnt we can see only this:</p>

<pre><code>&lt;select id="cities" style="min-width:212px;"&gt; &lt;/select&gt;
</code></pre>

<p>But if we run firebug , console:</p>

<p>Params: ajax    true
states  3
Response:
[{optionValue: 4, optionDisplay: 'Canberra'}]
Html:
[{optionValue: 4, optionDisplay: 'Canberra'}]</p>

<p>Issue is it does not work with latest jquery builds, in fact only seems to work with 
jQuery 1.2.3 - New Wave Javascript</p>

<p>So thats not a massive deal, as it uses very very little js. So wondered if you looked at this code, could you see what screams out at you as to why it doesnt operate with latest jquery build ?</p>

<pre><code>$(function(){
          $("select#states").change(function(){
            $.getJSON("select.php",{states: $(this).val(), ajax: 'true'}, function(j){
              var options = '';
              for (var i = 0; i &lt; j.length; i++) {
                options += '&lt;option value="' + j[i].optionValue + '"&gt;' + j[i].optionDisplay + '&lt;/option&gt;';
              }
              $("select#cities").html(options);
            })
          })


        })
</code></pre>

<p>Form:</p>

<pre><code>&lt;!-- form to change location--&gt;
                &lt;select id="states" style="min-width:212px;"&gt;
                    &lt;option value="-1"&gt;--Select--&lt;/option&gt;
                    &lt;?php
                    createoptions("states", "states_id", "states");
                    ?&gt;
                    &lt;/select&gt;
                    &lt;select id="cities" style="min-width:212px;"&gt;
                &lt;/select&gt;
            &lt;!--//end--&gt;
</code></pre>

<p>The php if its any use ( this on the select.php )</p>

<pre><code>&lt;?php
 error_reporting(E_ALL);
 ini_set("display_errors", 0);

  include("conndb.php");

  function createoptions($table , $id , $field , $condition_field , $value)
   {
   $sql = sprintf("select * from $table WHERE $condition_field=%d ORDER BY $field" , $value);
  $res = mysql_query($sql) or die(mysql_error());
   if (mysql_num_rows($res) &gt; 0) {
    while ($a = mysql_fetch_assoc($res))
    $out[] = "{optionValue: {$a[$id]}, optionDisplay: '$a[$field]'}";
    return "[" . implode("," , $out) . "]";
  } else

    return "[{optionValue: -1 , optionDisplay: 'No result'}]";
  }

  if (isset($_GET['states'])) {
echo createoptions("cities" , "cities_id" , "cities" , "states_id" , $_GET['states']);
  }


  die();
 ?&gt;
</code></pre>

<p>Lastyly the php for db connection:</p>

<pre><code>&lt;?php
 include("conndb.php");
 function createoptions($table , $id , $field)
 {
$sql = "select * from $table ORDER BY $field";
$res = mysql_query($sql) or die(mysql_error());
while ($a = mysql_fetch_assoc($res))
echo "&lt;option value=\"{$a[$id]}\"&gt;$a[$field]&lt;/option&gt;";
}
?&gt;
</code></pre>

<p>Ive posted almost evertyhing, just in case theses a ISSUE thats screaming off the page</p>
