[jQuery] Re: $.get() fetch a list of images

2009-05-21 Thread Ricardo
Ajax is asynchronous. When var total = splitted.length is executed the response might not have been returned yet. Put everything from "var slide(...)" on inside the callback, or in a function call. On May 21, 4:18 pm, Fabdrol wrote: > Hi all! > > I'm facing a problem, and it seems very unlogical

[jQuery] Re: $.get() fetch a list of images

2009-05-21 Thread Jeff
The problem is that while this section of your code is waiting for the ajax response: > $.get('ajax.txt', function(data) { >     splitted = data.split(','); > }); This section is already running... > var slide = $(elm).attr('slide'); > var total = splitted.length; > var next = slide+1 > var pic

[jQuery] Re: $.get() fetch a list of images

2009-05-21 Thread Jeff
Without the markup it's hard to provide a complete solution, but if I run this it works for me: $(document).ready(function(){ // Start with faked $.get() results [since that part works] var received = 'image1.png,image2.png,image3.png'; console.log