I ask the help of binding in the serial binding of ajax requests. (The example below does not work correctly). The correct sequence is 1-2-3-4.
HTML:
<div id="1" data-loader="../components/header.html"></div> <div id="2" data-loader="../components/navigation.html"></div> <div id="3" data-loader="../components/body.html"></div> <div id="4" data-loader="../components/footer.html"></div> Js:
<script> var url; var id; var j=1; $(document).ready(function () { $('div[data-loader]').each(function() { url=$(this).attr("data-loader"); id=$(this).attr("id"); $.get(url, function(data){ $('#'+j).html(data); j++; }); }); });