[jQuery] Re: getJSON url variable broken

2009-03-08 Thread David Muir
My guess is that you could still do it if you globally set async to false. Wouldn't recommend it though. David James wrote: Yes, David is right. My example would not work. Sorry about that. For other jQuery AJAX functions, there's an option to set 'async' to false if you do want to let your

[jQuery] Re: getJSON url variable broken

2009-03-06 Thread James
Yes, David is right. My example would not work. Sorry about that. For other jQuery AJAX functions, there's an option to set 'async' to false if you do want to let your script halt until the AJAX response is received. I don't think there's an option for getJSON for that, so you'll have to do every

[jQuery] Re: getJSON url variable broken

2009-03-05 Thread David Muir
You need to include what you want to do within the callback: $(function(){ var youtubeurl; $.getJSON('data.inc.json', function(j){ youtubeurl = j.video_url; so = new SWFObject(j.video_url, "TEST", "498", "278", "9.0.28","#00", "true"); //etc... });

[jQuery] Re: getJSON url variable broken

2009-03-05 Thread josp
that's not the problem unfortunately, cause my real script is different. The problem must be connected to the way $.getJSON parses the data On 5 Mrz., 21:11, James wrote: > The scope of your youtubeurl variable exists only within the callback > function of your getJSON(). Set the variable ou

[jQuery] Re: getJSON url variable broken

2009-03-05 Thread James
The scope of your youtubeurl variable exists only within the callback function of your getJSON(). Set the variable outside first. $(function(){ var youtubeurl; $.getJSON('data.inc.json', function(j){ youtubeurl = j.video_url; }); so = new SWFObject(youtubeurl, "TES