This morning I tried a different approach.
I had a select with id='propinsi', that had a list of province. When
it change, I'd like to change the options in the select with
id='kota'. I use the following code:
<script type="text/javascript"><!--
  $("#propinsi").change(function () {
    $(".loader").css("display","inline");
    $("#kota").load("workflow/table_query.php", {table: "kota",
parameter: this.value}, function()
{$(".loader").css("display","none");});
  } );
//--></script>

In firebug, I get Response:
...
<option value="30">Buleleng</option>
<option value="31">Denpasar</option>
...

and it's work well in firefox. But in IE6, I got an empty select. So I
tried a longer method:
<script type="text/javascript"><!--
  $("#propinsi").change(function () {
    $(".loader").css("display","inline");
    $.get("workflow/table_query_xml.php", {table: "kota", parameter:
this.value}, function (r, type) {
      //remove previous element except the first element
      $("#kota").children().gt(0).remove();
      var options = $("option",r);//r.getElementsByTagName("option");
      for (var i=0; i<options.length; i++) {
        var value = options[i].getAttribute("value");
        var label = options[i].getAttribute("label");
        $("#kota").append(new Option(label, value));
      }
      $(".loader").css("display","none");
    } );
  } );
//--></script>

In firebug, I get Response:
<options>
...
<option value="30" label="Buleleng" />
<option value="31" label="Denpasar" />
...
</options>

and it's work well too. But in IE6(again), I got an empty option only.
Option value seem set, because when I submit the form, it send a
correct value. The length of select now change according to the length
of response it get from server. In the first method, the select seem
always empty, no matter the response it get from server.

Any idea how i get these script work in IE6 ??


--
Donny Kurnia
http://hantulab.multiply.com/
http://hantulab.blogspot.com/
-------------------------------------------
At times the world can seem an unfriendly and sinister place. But
believe us when we say there is much more good in it than bad. And
what might seem to be a series of unfortunate events, may in fact, be
the first steps of a journey.
-- A Series of Unfortunate Events

_______________________________________________
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/

Reply via email to