1

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> 
10
  • What do you mean "loads half of page content"? Commented Aug 8, 2012 at 14:19
  • @SomeKittens The content is not displayed from <Html> to </html> it dislays other page html almost 30-40% and cuts other HTML Commented Aug 8, 2012 at 14:21
  • @SomeKittens Please check the alter box at tinyurl.com/botmn5v then you can understand what the issue is Commented Aug 8, 2012 at 14:23
  • @user580950 — It looks like it is being cut off due to the limitations in how much text can be entered into an alert(). Use something else to test it. Commented Aug 8, 2012 at 14:24
  • @user580950 instead of alert, use console.log() Commented Aug 8, 2012 at 14:25

1 Answer 1

1

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:

  1. You can log it in the browser's console using console.log(text)
  2. You can put it into a div using document.getElementById("divID").innerHTML = text
Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.