the first *might* use an extra cycle of processor but the reusability and 
readability of the code is key. 

 

the second is an anonymous function, it's not reusable as theres only one entry 
point.

 

if what you are doing is a never-to-be-used again one liner go for the second 
option, but personality i like my opening and closing braces to not be further 
apart than one screenful for readability. I now split everything i do into 
components.
 
> Date: Mon, 30 Mar 2009 07:16:13 -0700
> Subject: [jQuery] Re: How to wait for getJSON to complete before continue?
> From: iceange...@gmail.com
> To: jquery-en@googlegroups.com
> 
> 
> hmm... is there a diff bet
> 
> .getJSON("url", function_name);
> 
> function function_name(json) {
> 
> }
> 
> and
> 
> getJSON("url", function(json){ ... });
> 
> On Mar 30, 10:05 pm, Joseph Le Brech <jlebr...@hotmail.com> wrote:
> > get rid of the curly braces at the end of the delegate call also :)
> >
> > i accidentally left them in.
> >
> > From: martijn.hout...@gmail.com
> > Subject: [jQuery] Re: How to wait for getJSON to complete before continue?
> > Date: Mon, 30 Mar 2009 15:55:40 +0200
> > To: jquery-en@googlegroups.com
> >
> > On Mar 30, 2009, at 3:53 PM, ryan.j wrote:
> >
> > could you assign the data object to a global variable with the
> >
> > callback event?
> >
> > And how would you synchronize that? I'd go for Joseph's suggestion.
> >
> > Regards,
> > --
> > Martijn.
> > _________________________________________________________________
> >  25GB of FREE Online Storage – Find out 
> > morehttp://clk.atdmt.com/UKM/go/134665320/direct/01/

_________________________________________________________________
View your Twitter and Flickr updates from one place – Learn more!
http://clk.atdmt.com/UKM/go/137984870/direct/01/

Reply via email to