I currently have a basic AJAX load function set up to load a specific URL:
<div id="load">
<h1 id="status">Loading...</h1>
</div>
<script type="text/javascript">
$(document).ready(function(){
$.ajaxSetup({cache: false});
var url = "http://www.example.com/get.php?id=12345";
$('#load').replaceWith($('<div>').load(url));
});
});
</script>
Currently, I am not seeing the Loading...
text while the content is being loaded via AJAX. Shouldn't the replacement only happen after the new content has been successfully loaded? Additionally, if the AJAX load fails, how can I update the status to display Failed
?