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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 18, 20262026-05-18T10:11:46+00:00 2026-05-18T10:11:46+00:00

Is there any real advantage to using the jQuery AJAX function over the type

  • 0

Is there any real advantage to using the jQuery AJAX function over the type of AJAX function shown below? Obviously, the syntax is a little cleaner / shorter – but is there any noticiable difference that would justify re-writing my existing ajax code?

var ajax = getXmlObject();
var url= '/addPartToCart.php?m=' + encodeURIComponent(m) + 
         '&q=' + qty + 
         '&refresh=' + randomString();

if (ajax.readyState == 4 || ajax.readyState == 0) {
    ajax.open("POST", url, true);
    ajax.onreadystatechange = function (){
        if (ajax.readyState == 4) {    

        }
    }; 
    ajax.send(null);
} 

function getXmlObject() {
    if (window.XMLHttpRequest) {
        return new XMLHttpRequest();
    } else if(window.ActiveXObject) {
        return new ActiveXObject("Microsoft.XMLHTTP");
    } else {
        //error
    }
}

UPDATE

I’ve reprogrammed all of my AJAX functions to use jQuery’s .ajax(). I must say I’ve seen a notable improvement in speed and reliability.

  • 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-18T10:11:46+00:00Added an answer on May 18, 2026 at 10:11 am

    You may want to give a look to jQuery’s src/ajax.js source code. One reason it’s 720 sloc, and not just 10 is mainly to:

    • Fix and wrap known inconsistencies between the different browsers. The comments will reveal many of these issues.

    • Provide extra features like handling JSONP through the same interface, event hooks, etc. And other syntactic sugar.

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

Sidebar

Related Questions

I'm working on a project using Windows 2008, .NET 3.5 and WCF for some
According to C++'03 Standard 2.3/1: Before any other processing takes place, each occurrence of
Having learnt a bit about the subject, can anyone tell, what is the real
Why is :memory: in sqlite so slow? I've been trying to see if there
I'm working on a web application. There is one place where the user can
I'm fairly new to C#, and I think properties are a wonderful thing. So
I know a lot of the uses of .Net delegates can be emulated in
I have an ABC with several derived classes. To create these derived classes I
I've done it both ways, and to be honest other than the ability to
I'm writing an App that basically uses 5 business entities, A, B C, D

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.