I commonly want to pass an ID or some other information I know to an 
AJAX success handler.

>       $.post('/ajax/asset/insert', {
>         folder_tid : lastUploadedFolderTID,
>         link       : linkQueue[id]
>       }, handleAddLinkComplete, 'json');

In this example, I want to pass an ID to handleAddLinkComplete function. 
I know I can do the following, but they seem crufty to me.

   1. I can set a global variable with the link ID, but what if I have a
      bunch of post calls, there are synchronous issues (I know I can do
      async : false too)
   2. I could have my /ajax/asset/insert callback return the link ID
      back to me in the response, but it seems silly if I already know it.

I would love to do something like...

>       $.post('/ajax/asset/insert', {
>         folder_tid : lastUploadedFolderTID,
>         link       : linkQueue[id]
>       }, { callback : handleAddLinkComplete, arguments : [123] }, 'json');
or something.

What is the best way here or is my dream a reality?

Cheers,

-Rob

Reply via email to