Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 3 of 3

Thread: readyState 1

  1. #1
    Regular Coder
    Join Date
    Jul 2006
    Posts
    399
    Thanks
    33
    Thanked 7 Times in 7 Posts

    readyState 1

    how can i get the an equivalent ready state 1 across those 3 brownsers:safari, ie,ff.
    for ex: i have a simple "loading" string that shows up on readyState 1 but on safari it only shows after the second click over the ajax function, this features is crossbrowser if you use ajax with a library(jquery etc..) but what's the deal to make it cb using plain javascript?

  • #2
    Senior Coder A1ien51's Avatar
    Join Date
    Jun 2002
    Location
    Between DC and Baltimore In a Cave
    Posts
    2,717
    Thanks
    1
    Thanked 94 Times in 88 Posts
    It would help if you showed your code.

    Eric
    Tech Author [Ajax In Action, JavaScript: Visual Blueprint]

  • #3
    Regular Coder
    Join Date
    Jul 2006
    Posts
    399
    Thanks
    33
    Thanked 7 Times in 7 Posts
    Code:
    bio=getXmlHttpRequestObject();
    function _bio() {
    bio.open("GET", 'bio.htm', true);
    bio.setRequestHeader('If-Modified-Since','Wed, 05 Apr 2006 00:00:00 GMT');
    bio.onreadystatechange = function() {
    if(bio.readyState == 1){loader();}
    if(bio.readyState == 4 && bio.status == 200){
    document.getElementById("body_").innerHTML = bio.responseText;
    
    
                     				}
    			};
    bio.send(null);
                   };
    for creating the xhr i use:

    Code:
    function getXmlHttpRequestObject(){
    var xmlHttp=null;
    try{xmlHttp=new XMLHttpRequest();}
    catch (e){
    try{xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");}
    catch (e){xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
      }
     }
    return xmlHttp;
    }


  •  

    Posting Permissions

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