I'm new to jquery and I'm writing some code but I'd like to make sure
I'm not rewriting something that already exists. Basically, I'd like
to be able to do:

$("#myAnchor").addBehavior($("#targetDiv", new MyNewBehavior);

I implement a few functions for MyNewBehavior such as "buildURL"
and "stuffToDoAfter". When myAnchor is clicked on, an ajax request is
made to buildUrl (which might be a static URL or might build the URL
from parameters), then targetDiv is filled with the html fragment that
is sent to the "success" function, and finally stuffToDoAfter() is
executed in case you want to manipulate the newly added elements.

So it abstracts away the click() call, the ajax call, the
targetDiv.innerHTML = ajaxResponse, etc.

Anyone know if something like this already exists?

Reply via email to