[jQuery] Re: How to bind data to the ajax callback function?

2007-10-15 Thread arphenlin
Wizzud, Thanks for your help. I can understand the problem is the scope of variables. My idea is to transfer the userData to $.get() and then I can get it back in the callback function without considering the variable scope problem. Isn't it more intuitive? On Oct 16, 1:24 am, Wizzud <[EMAIL PROT

[jQuery] Re: How to bind data to the ajax callback function?

2007-10-15 Thread Andy Matthews
Probably when Apple tried to get into the browser business too. -Original Message- From: jquery-en@googlegroups.com [mailto:[EMAIL PROTECTED] On Behalf Of Wizzud Sent: Monday, October 15, 2007 12:24 PM To: jQuery (English) Subject: [jQuery] Re: How to bind data to the ajax callback

[jQuery] Re: How to bind data to the ajax callback function?

2007-10-15 Thread Wizzud
It's not ambiguous at all. Your problem is not with the $.get() but with the code around it. $.get() does exactly what it is intended to do - it fetches a single 'page' (of some sort) and provides you with the mechanism for handling that page when successfully retrieved. You are trying to handle m

[jQuery] Re: How to bind data to the ajax callback function?

2007-10-15 Thread arphenlin
It's so ambagious. I really hope jQuery can provide a *userData* parameter like this: jQuery.get( url, [data], [callback], [userData] ) Then I can achieve my goal with this way: for(var i=0; i<2; i++){ $.get(url+i, function(html, userData){ doit(html, userData['tag']); // userData was

[jQuery] Re: How to bind data to the ajax callback function?

2007-10-14 Thread Wizzud
var url='http://foo.bar/?param='; for(var i=0; i<2; i++){ submitAjax(i); } function submitAjax(i){ $.get(url+i, function(html){ doit(html, i); }); } function doit(html, tag){ alert(tag); } On Oct 13, 11:04 am, arphenlin <[EMAIL PROTECTED]> wrote: > Below is an example to u