Ok. I figured it out. It is a race issue. I needed to wait for the data to
load. I did not realize that load() had a callback.

Solution:

$("#province").load("/async/async_provinces.lasso?cc=" + val,
                        function() {$("#province").val(provincecode);});


Thanks

Steffan

---------------------------------------------------------------
T E L  6 0 2 . 7 9 3 . 0 0 1 4 | F A X  6 0 2 . 9 7 1 . 1 6 9 4
Steffan A. Cline  
stef...@execuchoice.net                             Phoenix, Az
http://www.ExecuChoice.net                                  USA
AIM : SteffanC          ICQ : 57234309
YAHOO : Steffan_Cline   MSN : stef...@hldns.com
GOOGLE: Steffan.Cline             Lasso Partner Alliance Member
---------------------------------------------------------------



> From: Steffan Cline <stef...@hldns.com>
> Reply-To: <jquery-en@googlegroups.com>
> Date: Sat, 23 Jan 2010 21:42:15 -0700
> To: "jquery-en@googlegroups.com" <jquery-en@googlegroups.com>
> Subject: [jQuery] Dynamic Selects
> 
> I am wondering if I'm missing something in my code.
> 
> I have a <select> that is populated via
> $("#mySelect").load("something.html"). This page of course returns a bunch
> of <option value="xx">XXXXX</option>. I have verified that the code is
> populated correctly via viewing the source.
> 
> After the .load() I try to set the selected value via .val("something").
> 
> The option I am trying to select is there. It's as if the .val(xxx) does not
> work on a select that is populated this way. Is there something I am
> missing? There has to be a work around.
> 
> Suggestions?
> 
> 
> Thanks
> 
> Steffan
> 
> ---------------------------------------------------------------
> T E L  6 0 2 . 7 9 3 . 0 0 1 4 | F A X  6 0 2 . 9 7 1 . 1 6 9 4
> Steffan A. Cline 
> stef...@execuchoice.net                             Phoenix, Az
> http://www.ExecuChoice.net                                  USA
> AIM : SteffanC          ICQ : 57234309
> YAHOO : Steffan_Cline   MSN : stef...@hldns.com
> GOOGLE: Steffan.Cline             Lasso Partner Alliance Member
> ---------------------------------------------------------------
> 
> 
> 


Reply via email to