> I have a bunch of ajax events that are fired one after an other to fill
> different spots on the page. Hence it's important that I know which dom
> element each on of the resulting data is supposed to belong to.
>
> I was wondering if there is a way I can pass the id of each element into the
> call so that it gets returned automagically without any intervention by the
> server?
>
> In YUI I can pass any number of arguments to an axax call and these
> areguments are available as part of the response.


You can achieve this sort of thing using closures.  For example:

function getData(id, url) {
    $.ajax({
        url: url,
        success: function(data) {
            $(id).html(data);
        }
    });
}

Reply via email to