How do I make sure that my script doesn't execute the $
(document).ready() function until all of the external xml files that
it's referencing are loaded? I have a framework that looks something
like this:
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript">
var myXmlDoc;
$.get('markup.xml', function(data) { myXmlDoc = data; });
$(document).ready( function() {
$('#name').autocomplete($('#username', myXmlDoc).get(), { /*
options */ });
$('#department').autocomplete($('#dept', myXmlDoc).get(), { /*
options */ });
...etc
}
</script>
Since I'm reusing myXmlDoc, I don't want to have to reload the file
every time I reference it. But the way that it's written now, the
variable gets referenced in $(document).ready before it's actually
loaded. How do I deal with this situation?
Thanks