I collect data through a jQuery Ajax call and output it to the page. I need to wait for the DOM to load and the Ajax call to complete before I can use the data to display it on the page. Can an Ajax call ever end before loading the DOM? I'm just trying to determine where I need to put my method, which will control the DOM and use the data that I return.
I would wait for the DOM to load before calling AJAX. Although it is unlikely that DOM READY will take longer than calling AJAX, this is just good practice.
AJAX , . script , , .
<div id="loadFile"></div> <script> $("#loadFile").load('filename'); </script>
, , . AJAX DOM, AJAX? , .
Source: https://habr.com/ru/post/1744963/More articles:Iphone Custom UITabBarItem without rounded edges - objective-cIs it possible to use script data as insert statements from an SSIS package? - sql-server-2008How to copy javascript object to another object? - jsonWPF ShowDialog returns immediately - visual-studio-2008send socket c ctrl + c behavior - cThe best approach for rails 3 I18n - ruby-on-railsBinding to an element in another node (XSLT) - htmlLaunching intro music on XNA with SoundEffect - xnaZend_Search_Lucene range query error - phpAndroid: How to get product information after scanning barcodes? - androidAll Articles