Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8914963
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T04:51:40+00:00 2026-06-15T04:51:40+00:00

I am new to javascript and especially to ajax..And just trying to figure it

  • 0

I am new to javascript and especially to ajax..And just trying to figure it out..

i wrote this code from one tutorial and can’t find what i did wrong. Here you can see it live

The error i am getting from Firebug: “TypeError: xmlhttp is undefined
[Break On This Error]

if (xmlhttp.readyState == 4){“

my code is

// JavaScript Document

var xmlhttp;
var url;

function ajaxFunction(){

if  (window.ActiveXObject){//if the window is InternetExplorer

    xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");

    }else if(window.XMLHttpRequest){// if Window is Firefox etc..

        xmmlhttp= new XMLHttpRequest();

        }else{

            alert ("Get a New Browser")

            }

}//end of ajaxFunction()


function getInfo(){

    ajaxFunction();

    var entryInfo= document.getElementById("entry").value;

            function stateChanged(){
                if (xmlhttp.readyState == 4){

                    document.getElementById("results").innerHTML = xmlhttp.responseText;

                    }//if (xmlhttp.readyState == 4)

                }//end of function stateChanged()


url = "info.php?user="+entryInfo;
xmlhttp.onreadystateshange=stateChanged();
xmlhttp.open("GET",url,true);
xmlhttp.send(null);


    }// end of function getInfo
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-15T04:51:41+00:00Added an answer on June 15, 2026 at 4:51 am

    You have a typo here:

       xmmlhttp= new XMLHttpRequest();
         ^
    

    Change to

     xmlhttp= new XMLHttpRequest();
    

    Also as Michael pointed out, you have parenthesis when assigning your onreadystatechange function:

    xmlhttp.onreadystateshange=stateChanged();
                                           ^ remove the ()
    

    If you don’t remove the parenthesis, the stateChange() function will be called, and the return value will be given to xmlhttp.onreadystateshange which you don’t want.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

im new at javascript and i can get this slider to work but not
New Google Analytics code looks like one below: <script type=text/javascript> var _gaq = _gaq
I am new to jQuery and especially to JavaScript. I am trying to create
I'm relatively new javascript, but I am comfortable in other languages. I'm trying to
New to javascript and such, trying to create a loop for fading logos using
New to javascript, but I'm sure this is easy. Unfortunately, most of the google
Very new to javascript and html-type stuff. I wanted to just make a quick
I`m new to JavaScript and I need some help extracting the ID from URL
Ok im new to javascript and Unity so this is clearly a very noob
This week I decided to add a new element to a javascript array by

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.