I'm trying to use the $.get() function to load a portion of a website into a variable to us later. The code I currently have is:
$(document).ready(function(){
var container;
function loadData(data, targetVar) {
container = data;
}
$.get('page.html#div', loadData(container));
the problem is the callback function keeps firing before the page loads leaving the variable with an undefined value.