Sending extra parameters to JavaScript Events

13Jul09

Let’s say you want to use something like :

$.GetJson(url,printResults,textStatus);

Well what if you need to send additional information to printResults() ? I’ve been coding C# to long. I vaguely remember events before delegates and I haven’t made a function pointer since freshmen year in college. I’m not actually sure if there is a way of sending extra parameters to an event like this, but my solution was just to use an anonymous function before hand.

So something like this:

$.getJSON(request, ajaxData,
function(data, textStatus) {
printResults(extraDataToSend, data, textStatus);
}
);



No Responses Yet to “Sending extra parameters to JavaScript Events”

  1. Leave a Comment

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Connecting to %s


Follow

Get every new post delivered to your Inbox.