Hello, I am developing my blog from scratch, using XHTML and jQuery 1.2. On a page, I have multiple posts, each having a "show comments" link, that is handled by jQuery. I want it to fetch the comments on the PHP backend using Ajax, and insert them in the DOM. This way, comments would be dynamically loaded.
Currently, I have this: $.get('/blog/get-comments.php', {'id': newsID}, JW.HomePage.commentsLoaded); JW.HomePage.commentsLoaded = function(data, textStatus) { } My problem is: how do I know in the JW.HomePage.commentsLoaded callback which comments have loaded? There might be multiple comments being fetched at the same time, so the use of a global variable is not a good idea, IMHO. For now, the PHP script is returning a div containing everything, and that div has an ID that contains the post ID, but I don't like this solution because if for some reason I get garbled HTML from the backend, I want to fall back on my feet. Also, I don't like the idea of parsing this.url for the ID of the post I retrieved, because it's not very safe either. Question is : Is there a way to join data to the jQuery Ajax object and get the data back in the different callbacks? This way I could keep the ID of the DIV i'm loading data into with each request. Any help appreciated, Thanks a lot, Jordan