1. Computer problem? Tech Support Guy is completely free -- paid for by advertisers and donations. Click here to join today! If you're new to Tech Support Guy, we highly recommend that you visit our Guide for New Members.

AJAX passing statechanged variables

Discussion in 'Software Development' started by scrubbicus, Dec 13, 2009.

Thread Status:
Not open for further replies.
  1. scrubbicus

    scrubbicus Thread Starter

    Joined:
    Jan 23, 2009
    Messages:
    197
    So I'm having a difficult time passing statechanged a variable to tell it where to put my responseText, I've tried alot so I'm thinking that I can't do it that way but I figure there must be a way to tell xmlhttp where to write the resposeText when the readystate hits 4.

    This is what I have

    PHP:
    xmlhttp.onreadystatechange stateChanged;

    function 
    stateChanged() {
      if( 
    xmlhttp.readyState == ) {
        
    document.getElementById("message").innerHTML="Loading...";
      } else if( 
    xmlhttp.readyState == ) {
         
    document.getElementById("message").innerHTML=xmlhttp.responseText;
     }
    I tried

    PHP:
    xmlhttp.onreadystatechange stateChangedelementID );
    then just accepted it on stateChanged() and using it in the getElementById
     
As Seen On
As Seen On...

Welcome to Tech Support Guy!

Are you looking for the solution to your computer problem? Join our site today to ask your question. This site is completely free -- paid for by advertisers and donations.

If you're not already familiar with forums, watch our Welcome Guide to get started.

Join over 733,556 other people just like you!

Thread Status:
Not open for further replies.

Short URL to this thread: https://techguy.org/885299

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice