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 8367957
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T13:16:47+00:00 2026-06-09T13:16:47+00:00

This is my first question regarding PHP so please bear with me. I’ve been

  • 0

This is my first question regarding PHP so please bear with me. I’ve been following tutorials from phpacademy.org.

I’m stuck on one tutorial where an intro to AJAX is given. I typed in the exact code as the tutor, still its not working on my end.

I searched alot for it but it didnt help one bit. Could anybody help me out here? Here’s my code:

<html>
<head>
<script type="text/javascript">
function load(){

if(window.XMLHttpRequest)
    xmlhttp=new XMLHttpRequest();
else
    xmlhttp=new ActiveXObject('Microsoft.XMLHTTP');

xmlhttp.onreadystatechange=function(){
if(xmlhttp.readyState==4 && xmlhttp.status==200){
    document.getElementsById('adiv').innerHTML=xmlhttp.responseText;
}
}
xmlhttp.open('GET', 'AJAX.inc.php', true);
xmlhttp.send();
}
</script>
</head>
<body>
<div id="adiv"></div>
<input type="submit" value="Submit" onclick="load();">
</body>
</html>

And here’s the AJAX.inc.php file:

<?php
echo 'Hello AJAX';
?>

However another example from w3school.com is working.

Possible duplicate:
AJAX not working with XAMPP or is it just impossible

But this question isn’t properly answered (or I dont understand it). Would someone please clarify it?

  • 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-09T13:16:49+00:00Added an answer on June 9, 2026 at 1:16 pm

    There is no document.getElementsById method.

    document.getElementsById('adiv').innerHTML=xmlhttp.responseText;
    

    Should be

    document.getElementById('adiv').innerHTML=xmlhttp.responseText;
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm using the first answer to this question Overcoming Python's limitations regarding instance methods
This is my first question, so please be gentle. I'm trying out Apache Camel
first question here, this is regarding the iPhoneOS3 not MacOSX. I am fairly new
First of all there is a partial question regarding this, but it is not
First, I noticed there are many questions regarding this, lots marked as duplicate. I
this is my first question in here, and I would like to ask if
This is my first question on Stack Overflow, so I hope that I'm clear
this is my first question to SO so i'll try not to disgrace myself.
this is my first question I have searched for any launching activity questions and
this is my first question here so be gentle ! recently i try to

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.