I am wondering how I use Jquery selectors within the Ajax response. My site has a feed and each main block has a unique ID, but I dont want to uniquly ID every div thats wit
This is a side-effect of the callback function being invoked asynchronously. When it is called, this
is no longer what you expect it to be.
Saving the current value of this
in a variable before you create the callback helps:
var self = this;
function (msg) {
var container = $(self).parent().attr('id');
alert (container); //returns undefined
}