Ajax Pattern Question
I'm not a hardcore Javascript guy but I certainly have done my fair share of coding in the past, with and without Ajax, with and without libraries, etc.
One thing that's always racked my brain is that on a page that loads multiple pieces of content in via Ajax at the same time, how do you do this without needing multiple copies of the same function? When I've tried this in the past with a function called like this:
loadIntoPage( 'IDofdiv', 'http://ajaxurl.com/returnhtml.php');
The multiple Ajax calls get all tangled up, their variables overlap, and nothing ends up displaying. But if I make multiple copies of that function (one for each Ajax-loaded block) and name all the variables differently, then it works.
I know there's a better way of doing it, so does anyone have some insight?
