I am loading an html page through ajax which contains a JS object. How do you get a reference to the object inside the freshly loaded (child) page to the parent page?
Parent:
//parent.html
<script>
function ParentObject() {
this.children = new Array();
}
var aParentObject = new ParentObject();
$.get('/url/to/child.html', function(data) {
$("#child-div").html(data);
});
</script>
Child:
//child.html
<div>Some html element</div>
...
<script>
function ChildObject() {
this.someProperty = "I'm a Child";
}
var aChildObject = new ChildObject();
</script>