Monday, March 30, 2009

[jQuery] Re: How to wait for getJSON to complete before continue?


On Mar 30, 2009, at 4:16 PM, iceangel89 wrote:

hmm... is there a diff bet


.getJSON("url", function_name);


function function_name(json) {


}


and


getJSON("url", function(json){ ... });


Well, 

    $.getJSON(url, function_name);

    function function_name(json) { ... }; 

and

    $.getJSON(url, function(json) { ... });

have the same effect (the first is a named function while the latter is an anonymous function). Note what Joseph says about the curly braces: they need to be removed.

Regards,
-- 
Martijn.

No comments: