[jQuery] Re: ajax api question

2007-07-12 Thread Salvatore FUSTO
Hi, you can also write $.post('test.cgi', params, function(data) { myCallback(data,arg1,...);}); function myCallback()data, arg1,...){...} if you need to pass arguments, other than data, to callback function salvatore - Original Message - From: james_027 [EMAIL PROTECTED] To: jQuery

[jQuery] Re: ajax api question

2007-07-11 Thread Benjamin Sterling
James, In: $.post('test.cgi', params, function(data) { alert(data); } ); where data that is being passed thru the function to the alert is the argument that the $.post function is passing it. and: $.post('test.cgi', params, alert(data)); where data, if not set, will alert undefined

[jQuery] Re: ajax api question

2007-07-11 Thread Eric Crull
The first example is a closure. It only operates when the $.post function is completed. If you just tried to use the alert(data) as you have in the second example it would execute right away. A closure is the equivalent to burying a time-capsule in the ground to be dug up later. You could

[jQuery] Re: ajax api question

2007-07-11 Thread james_027
Hi benjamin, Thanks for your fast reply. Thanks for explaining things ... If I understand it correct data is something $.post created right? Things now make sense. james On Jul 12, 10:32 am, Benjamin Sterling [EMAIL PROTECTED] wrote: James, In: $.post('test.cgi', params, function(data)

[jQuery] Re: ajax api question

2007-07-11 Thread james_027
Hi, Is javascript closure different from closure of the other languages? Thanks for explaining things and the article you shared. james On Jul 12, 10:03 am, Eric Crull [EMAIL PROTECTED] wrote: The first example is a closure. It only operates when the $.post function is completed. If you