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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T03:00:44+00:00 2026-05-20T03:00:44+00:00

I have checked the suggestions that came up before posting, hope I didn’t miss

  • 0

I have checked the suggestions that came up before posting, hope I didn’t miss anything now.

I have a piece of code that I use to get txt-files for my website but now I need to redo the code so it gets both txt and php-files, but it just won’t read the php-script. I’m a bit afraid to mess up the code at this moment so I’m walking on the safe side of the road and ask here if anyone knows a good add to the code. It’s quite embarrasing that I still have codes for IE 5&6 in it, so if you wish to remove that at the same time, go ahead. I won’t hate you for it, I promise.

UPDATE:
I have four files:
html – Calling the .js-file with the ajax-script.
js – With all my javascript(and simular)-codes.
php – That contains… Well, you get the point.

I have to call the php-code somehow, like I call my txt-files, but of course so the php works as it should. I am very new to AJAX, so I don’t dare to mess around with this code at the moment, but I figured that I might be able to add some kind of if-statement that calles the php-file as it is intended to be.
But I have no clue what that code might be and where to put it for things to work accordingly. Any help would be appritiated and credited in the code, of course.

Heres the AJAX-code that is contained within the .js-file:

/*Load the link.*/
function loadXMLDoc(url)
{
    if (window.XMLHttpRequest)
    {// code for IE7+, Firefox, Chrome, Opera, Safari
        xmlhttp=new XMLHttpRequest();
    }
    else
    {// code for IE6, IE5
        xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
    }
    xmlhttp.onreadystatechange=function()
    {
    if (xmlhttp.readyState==4 && xmlhttp.status==200)
    {
        document.getElementById("leftCol").innerHTML=xmlhttp.responseText;
    }
    }
    xmlhttp.open("GET",url,true);
    xmlhttp.send();
}
/*Highly unnecessary, but I wanted to see if it worked and it looks better on the .html-page.*/
function get_link(url)
{
  loadXMLDoc(url);
}
  • 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-05-20T03:00:45+00:00Added an answer on May 20, 2026 at 3:00 am

    it just won't read the php-script

    It’s a rather vague statement, but here are few pointers that could be the solution :

    PHP file are interpreted on the server so when you do an Ajax call to that page what you receive on the client side is the result of that php script, not his content.

    You are assigning the result of the query directly in the HTML, if the result contains data that does not render anything, you won’t see anything. For example the content <script>Text here bla bla bla</script> will just show nothing.

    If you want to make sure you get some data back from a file, you can just alert the content when you receive it.

    Make sure your path to your PHP page is correct. To detect if the file is not giving a 404 error code or any other error code, you can use this :

    xmlhttp.onreadystatechange = function() {
        if (xmlhttp.readyState == 4) {
            if (xmlhttp.status == 200) {
                document.getElementById("leftCol").innerHTML = xmlhttp.responseText;
            } else {
                alert("Error " + xmlhttp.status);
            }
        }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have checked out now a local working copy of a codebase that lives
I have checked this similar question, but the suggestions did not solve my problem:
I have checked few other posts and found some UIAnimation transitions that kind-of give
I have checked the assembler options of GNU assembler as and I didn't find
I have some code that has generic references in it and my IBM RAD
I have one project that I checked out from one SVN repository location and
I have code that creates an XML document that is difficult to read in
I have some code that shows/hides checkboxes using the visibility attribute. If the button
I have checked many questions here but none has my answer. I appreciate if
I have checked with Aweber customers service and they told me their internal function

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.