[jQuery] Question about ajax and the DOM
Hi there,
I've started playing with the ajax functionality of jquery and run
into some quirks that I hope someone will give some advice about.
The first thing is that I have events applied to various elements
for deleting/inserting records and then updating the DOM with the new
content which I'm doing via taconite. I've got a list of items that when
one is added or removed I replace the entire list with the latest list
from the database using an ajaxSubmit to taconite. This caused some odd
behaviour, or loss of behaviour. I assumed that because I replaced the
content the event listeners were lost too. Now I have a callback
function that resets them but this seems like a clunky way of doing
things, iterating over all the elements each time there's a DOM update.
What are the best/fastest methods for this sort of functionality? Adding
the new record on it's own and then adding whichever event to it once
it's loaded? Or do I have the wrong end of the stick entirely?
If it's easier to point me to a guide or faq about what to consider
when using ajax methods extensively that would be good but I would
really appreciate any advice you can give me.
Hope that makes some kind of sense,
Rob