I am using following JavaScript/Ajax to read page content, This script works great but it loads only Half of the page contents of shoppingcart.asp, I want the shoppingcart.asp to load fully and then show all webpage contents, is this possible, shall I add a delay?
<script language="Javascript"> var anUrl = "http://www.abc.com/shoppingcart.asp"; var myRequest = new XMLHttpRequest(); callAjax(anUrl); function callAjax(url) { myRequest.open("GET", url, true); myRequest.onreadystatechange = responseAjax; myRequest.setRequestHeader("Cache-Control", "no-cache"); myRequest.send(null); } function responseAjax() { if(myRequest.readyState == 4) { if(myRequest.status == 200) { result = myRequest.responseText; alert(result); alert("we made it"); } else { alert( " An error has occurred: " + myRequest.statusText); } } } </script>
alert(). Use something else to test it.alert, useconsole.log()