As you've probably found, there is no sleep/wait/pause in JavaScript. The
whole system is single-threaded, so any sort of "sleep" would hose the whole
system.
Your original statement doesn't actually make sense. As it is, function2
*doesn't* execute until open_popup returns, so that isn't really your
problem. It sounds like you want function2 to execute after something setup
within open_popup happens, which you would do with a callback.

Good luck.

--Erik


On Sun, May 24, 2009 at 6:57 PM, macphreak <swhit...@gmail.com> wrote:

>
> No, it doesn't involve Ajax. Although I wish it did. It would be a lot
> easier for me to define a call back then. :)
>
> This is code that I have to work with (or work around I should say)
>
> Thanks again for any helpful hints!
>
> On May 24, 6:33 pm, Ricardo <ricardob...@gmail.com> wrote:
> > what's the code for open_popup? does it involve ajax?
> >
> > http://www.ibm.com/developerworks/web/library/wa-ajaxintro2/#N103A2
> >
> > On May 23, 2:42 pm, macphreak <swhit...@gmail.com> wrote:
> >
> >
> >
> > > I have seen a few of threads on this issue. However, they have mostly
> > > deal with the fadeins or fadeouts which is not what I am needing. Here
> > > is what I need:
> >
> > > On a click event, start function 1. Then after it's finished, start
> > > function2. Here is my code:
> >
> > > var $j = jQuery.noConflict();
> >
> > >                 $j(document).ready(function(){
> > >                         $j("#select_inv").click(function() {
> > >                                 open_popup("Inv_Inventory", 600, 400,
> "", true, false,
> > >
> {"call_back_function":"set_return","form_name":"EditView","field_to_name_ar
> ray":
> > >
> {"id":"inv_inventory_id_c","name":"name_c","make_c":"make_c","model_c":"mod
> el_c","year_c":"yearmanufactured_c","bodystyle_c":"bodystyle_c","vin_c":"vi
> n_c","miles_c":"odometer_c","exteriorcolor_c":"exteriorcolor_c","interiorco
> lor_c":"interiorcolor_c","trim_c":"trim_c","stocktype_c":"conditionstocktyp
> e_c"}},
> > > "single", true);
> > >                                         function2();
> > >                                 });
> > >                         });
> > >                 });
> >
> > > Right now, it runs the open_popup function fine. However, it runs
> > > function2() immediately. I need it to wait until the open_popup
> > > function is finished, and then run the function2() script.
> >
> > > Any help would be greatly appreciated!  Thanks!
>

Reply via email to