Results 1 to 2 of 2

Thread: Page loads nothing for forever in firefox (IE?)

  1. #1
    Join Date
    Nov 2007

    Page loads nothing for forever in firefox (IE?)

    Hello all,
    I'm having some trouble with my AJAX library. My page starts the way it should, by retrieving the text "Hello world!" from info.txt and puts it in the body. Problem is, after that, Firefox tries to load something. I don't even know what. The request doesn't show up in firebug. And many other weird things happen, such as, when looking at the page source, all I see is the text it loaded, and I can't create a new line in this text box unless I press Shift+Enter (this only happens some times).
    Anyway here's my scripts. Many thanks for any errors you can weed out...
    function AjaxLibrary() {
      this.AjaxHandle = function() {  //CALL THIS FIRST!!! Returns Handle for an XMLHttpRequest or -1 for a browser that doesn't support AJAX
        if(typeof ActiveXObject != "undefined") {
          try {
            XMLHRH = new ActiveXObject("Msxml2.XMLHTTP");
          } catch (XHRH_Except1) {
            try {
              XMLHRH = new ActiveXObject("Microsoft.XMLHTTP");
            } catch (XHRH_Except2) {
              return -1;
        } else if (XMLHttpRequest) {
          try {
            XMLHRH = new XMLHttpRequest();
          } catch (XHRH_Except3) {
            return -1;
    	return XMLHRH;
      this.LoadPage = function(RequestHandle, RequestURL, CallBack, State1, State2) { //Call to load a page. RequestHandle should be return value from AjaxHandle,
        // CallBack should be function called when readyState changes (as well as when page has been loaded; it needs 2 args: 1 is readystate, 2 is responsetext), and
    	// State1 & State2 are optional, readystatechange function is called if readyState is equal to one of these. Callback should also take -1 for error loading page.
        RequestHandle.onreadystatechange = function() {
    	  if (RequestHandle.readyState == State1) {
    	  } else if (RequestHandle.readyState == State2) {
    	  } else if (RequestHandle.readyState == 4) {
    	    if (RequestHandle.status==200) {
    		  CallBack(4, RequestHandle.responseText);
    		} else {
        preventCache = (RequestURL.indexOf("?")!=-1) ? "&" + new Date().getTime() : "?" + new Date().getTime();
        RequestHandle.open('GET', RequestURL + preventCache, true);
    HTML Code:
        <title>Test AjaxLibrary.js</title>
    	<script type="text/javascript" src="./ajaxlibrary.js"></script>
        <script type="text/javascript">
    	  var HandleLoading = function(RequestStatus, ResponseText) {
    	    if (RequestStatus == 4) {
    	  AjaxLib = new AjaxLibrary;
    	  AjaxHandle = AjaxLib.AjaxHandle();
    	  AjaxLib.LoadPage(AjaxHandle, "./info.txt", HandleLoading);
    Many thanks for any help!

    P.S. - In IE, this page loads fine at first, but when I try to get it to load again (not via refresh), it will also load nothing for forever. and clicking the X won't make it stop. Trying to close the window, it says that the window is busy and closing it might cause some problems.
    This is becoming very confusing...

  2. #2
    Join Date
    Feb 2006
    This replaces the original page with the text response.

    Until you call document.close() in the new document,
    from a script you include in the document.write,
    it will keep waiting for more input.
    Last edited by mrhoo; 10-04-2008 at 11:10 PM.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
HTML5 Development Center