Here is a working example:
var myvar;
$.get('formElements.html', function(data) {
myvar = data;
});
However, this code does not work as intended:
var myvar;
$.get('formElements.html .className', function(data) {
myvar = data;
});
The goal here is to retrieve contents from a specific div in another file and store it in the variable myvar.