Thursday, February 26, 2009

[jQuery] Re: Ajax request -- passing additional paramters to success method

Nevermind... I can do it with lambdas.


--
Patrick Burrows
http://www.CleverHumans.com


On Thu, Feb 26, 2009 at 11:50 AM, P Burrows <pburrows@gmail.com> wrote:
Is anyone aware of a way to pass some additional context information to the "success" function of an ajax request?

For instance, here is my code which works fine:

$.ajax({
        type: "GET",
        dataType: "json",
        url: tUrl,
        success: GotNewData,
        error: GetDataError,
        complete: AjaxRequestComplete
    });


To the "GotNewData" function, I would also like to pass some other information. The url would be nice, but some other context info would be fine too. A unique ID. Some random string. ...anything.

Any ideas?


--
Patrick Burrows
http://www.CleverHumans.com

No comments: