This is probably straight forward but I'm a newbie and I need help! If I make an Ajax request which when successful replaces a section of the DOM with other data, how do I make the new data accessable to jQuery?
the Data will be available in the parameter you pass to the callback function
$.ajax( {
type:'Get',
url:'http://mysite.com/mywebservice',
sucess:function(data) {
alert(data);
}
})
Which you could also express using the Ajax shorthand get
$.get('http://mysite.com/mywebservice', function (data) {
alert(data);
});
And if you mean how to access the data after you injected it to the DOM, then it will be automatically accessible because it becomes a part of the DOM.
In the callback function you provide to the ajax request, you will have access to the data. From there you can replace part of the DOM with it and/or store it somewhere else (global variable, etc.).
The elements in the replaced area have no event handlers bound, of course, unless you use jquery 1.3's new live() events.