Reputation: 5377
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>
Upvotes: 1
Views: 602
Reputation: 39522
JavaScript's alert()
has a maximum amount of text that it can contain. If you want to check large amounts of text, there are two options:
console.log(text)
div
using document.getElementById("divID").innerHTML = text
Upvotes: 1