I've actually posted code before that does exactly what you're trying
to do. Check out the function here: 
http://snipplr.com/view/10368/jquery-automatic-script-includer/

On Jan 27, 7:57 am, Beres Botond <boton...@gmail.com> wrote:
> That *should* get called twice. What does debug() do?
> If you put alert() instead of it, it will still be just 1 alert?
> Also If you can test it in Firefox with Firebug addon (http://
> getfirebug.com/), you should be able to see if
> there are actually 2 requests going out correctly (and the response
> too).
>
> On Jan 27, 6:53 am, bob <xoxeo...@gmail.com> wrote:
>
> > Hi,
> > How can access index i inside of "complete" method?
> > The following gives me just the last value of i.
>
> > var scripts = ['script1.js', 'script2.js'];
>
> > for(var i=0; i<scripts.length; i++){
>
> >         jQuery.ajax({
>
> >                         dataType: 'script',
> >                         url: scripts[i],
> >                         complete: function (XMLHttpRequest, textStatus) {
> >                                         debug('i = ' + i + '   complete:  
> > textStatus = ' + textStatus);
>
> >                         }
> >                 });
>
> > }

Reply via email to