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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 14, 20262026-05-14T22:06:44+00:00 2026-05-14T22:06:44+00:00

I have come across a website that appears to use Ajax but does not

  • 0

I have come across a website that appears to use Ajax but does not include any js file except one file called ajax.js which has the following:

function run(c, f, b, a, d) {
    var e = null;
    if (b && f) {
        document.getElementById(b).innerHTML = f
    }
    if (window.XMLHttpRequest) {
        e = new XMLHttpRequest()
    } else {
        if (window.ActiveXObject) {
            e = new ActiveXObject(Microsoft.XMLHTTP)
        }
    }
    e.onreadystatechange = function () {
        if (e.readyState == 4) {
            if (e.status == 200 || e.statusText == "OK") {
                if (b) {
                    document.getElementById(b).innerHTML = e.responseText
                }
                if (a) {
                    setTimeout(a, 0)
                }
            } else {
                console.log("AJAX Error:  " + e.status + " | " + e.statusText);
                if (b && d != 1) {
                    document.getElementById(b).innerHTML = "AJAX Error.  Please try refreshing."
                }
            }
        }
    };
    e.open("GET", c, true);
    e.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
    e.send(null)
}

Like you might have guessed, the way it issues queries inside the page with queries like this:

run('page.php',loadingText,'ajax-test', 'LoadSamples()');

I must admit that this is the first time I’ve seen a page from which I could not figure how things are being done. I have a few questions:

  • Is this Server-Side Ajax or
    something similar? If not, can someone
    clarify what exactly is this?
  • Why does one use this? Is it for hiding the design details? (which are otherwise revealed in plain text by javascript)
  • How difficult would it be to convert my
    existing application into this design
    pattern? (maybe a subjective question but any short suggestion will do)

Any suggestions?

  • 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-14T22:06:45+00:00Added an answer on May 14, 2026 at 10:06 pm

    Not sure what you’re exactly asking here, but the function given is actually fairly simple. Decoding the variables / parameters:

    • e = AJAX request object
    • c = Page to send AJAX request to
    • f = Loading text to be displayed in specified element b
    • b = id of element to display result in
    • a = Function to call if ajax request succeeds
    • d = boolean – if true, display an error on failure

    Exactly why they’re using this particular method I can’t really say – seeing the complete page that uses this functionality may help.

    I don’t think it’s hiding any design details. It does look a slightly odd way of doing things to me, but as I said above, there may be specific reasons for this in the way the page it’s being used in works.

    Can you use this code? Certainly.

    Should you use this code? The answer to that is: Is it the right tool for the job?

    How difficult would it be to convert your existing code to use this method? That depends on your existing code and whether this is the right tool for the job.

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

Sidebar

Related Questions

In building my responsive website I have come across a bug that appears only
I have come across scripts that use: isset($_POST['submit']) as well as code that uses:
I have come across loop-unrolling but what other types of compiler optimization are there
I have come across a situation (which I think is weird but is possibly
I've come across a system that is in use by a company that we
I'm designing a new website and I have come across a problem. The way
I've come across this several times, ctrl-c randomly does not copy. I think it's
I've been experimenting with ASP.Net MVC, and have come across a problem that is
I have made a website that uses unordered lists. These lists use an image
One problem that I come across regularly and yet don't have a solution 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.