I have a question about inserting html with JavaScript into the DOM after an Ajax call using JQuery's .load().
Assume the following sample html section:
<script>$(document).ready(function(){var e = $('#'+'@Servergenerated');})</script>
<div id='@Servergenerated'>Test Element</div>
If I return the above section through an Ajax call and insert the result into the DOM using JQuery's load() function -- Will both the markup rendering and the script execute as a blocking call? Meaning, since .load() executes on the single thread available to JavaScript, will it ensure that both the markup rendering and the JavaScript execution will finish before other JavaScript on the same main page can be invoked ?
The Ajax request is initiated through $("#someElement").load(..)
In the above case, can I always assume that the JS is always paired up with the correct html (so that the JS will execute against the ID that is currently defined on the page)
However, is there a difference between using .load() and .html().
Typically I use $.get to retrieve the data and then insert it into the DOM using .html(). This code is however in a third party library and it's uisng .load() instead..