0

I am trying to understand what the term 'AJAX' actually implies. I do understand it stands for Async JAvascript over Xml.. And I understand that it doesn't necessarily require XML (we can use json for example). I understand that AJAX is a paradigm of updating only a partial web page without requiring a full post/refresh to the server.

What my question is one of semantics: if I create a web page with a button that when pushed will call jQuery.Get() to a server to refresh a page with partially - does this mean I am using AJAX?

Or, is AJAX very specifically a set of Microsoft objects / technologies?

Thank you for the clarification

drew
  • 97
  • 1
  • 11
  • 1
    Ajax is a tool. Yes, you are using it, unless you're using an iframe. – Kevin B Oct 02 '14 at 14:55
  • Look into xmlhttprequest (http://en.wikipedia.org/wiki/XMLHttpRequest) – DarkBee Oct 02 '14 at 14:56
  • Actually it stands for `Asynchronous JavaScript and XML` – LcSalazar Oct 02 '14 at 14:56
  • 1
    Any time you use *JavaScript* to issue an HTTP request you are using *Ajax* which is the term used to describe the use of the various implementation of the `XMLHttpRequest` object. (WebSockets would be the only exception to this) – Alex K. Oct 02 '14 at 15:03
  • @KevinB - Ajax is not actually a tool. It's a term to describe the use of combined tools... – LcSalazar Oct 02 '14 at 15:07
  • 1
    @LcSalazar Why is that distinction important? And why is HTML considered part of it in your answer? HTML would be just one more data structure that can be transported by it, similar to json, text, xml, base64, etc. In the end everything is transported as plain text with an attached content-type. – Kevin B Oct 02 '14 at 15:08
  • @KevinB, I was quoting the MDN's docs on Ajax that states as the combined technologies for ajax: `HTML or XHTML, Cascading Style Sheets, JavaScript, The Document Object Model, XML, XSLT, and XMLHttpRequest object.` – LcSalazar Oct 02 '14 at 16:13
  • Can't go read them myself(mobile at the moment), but that doesn't make sense... Why would CSS be lumped in there as being related to Ajax? I can somewhat see why HTML might have been included in that list, but.... CSS? – Kevin B Oct 02 '14 at 16:16

4 Answers4

1

Jquery .get() and .post() is both .ajax() wrappers and as names suggests, .get() is using type: "GET" and .post() is using type: "POST" in ajax call.
So yes, when using jQuery .get() and .post() you are using .ajax() simplified version. Also .ajax() is simple wrapper over JS XMLHttpRequest (as whole jQuery does).
So in the end you are using nothing more than JS.

Justinas
  • 41,402
  • 5
  • 66
  • 96
0

If the user clicks a button and the browser makes a request and replaces the entire contents of the current page with another page, then that's not AJAX.

On the other hand, if the browser loads a page, and then submits subsequent HTTP requests triggered by events which then cause the page to alter content or design, then that is AJAX. It doesn't matter which browser.

AJAX uses XMLHttpRequest to send requests, and typically uses the response to do make a change on the page. jQuery.get() (and jQuery.post(), etc) is just a wrapper that makes AJAX a bit easier to use, and more consistent across different browsers.

See also: how does an Ajax request differ from a normal browser request?

Community
  • 1
  • 1
Dan Blows
  • 20,846
  • 10
  • 65
  • 96
-1

Yes. You are using AJAX. jQuery.get is shorthand for:

$.ajax({
  url: url,
  data: data,
  success: success,
  dataType: dataType
});

http://api.jquery.com/jquery.get/

Joseph
  • 760
  • 1
  • 4
  • 9
-2

AJAX is actually a terminology applied to the use of combined technologies such as HTML, Javascript, and specially the xmlHttpRequest object.

This one (xmlHttpRequest) is actually the core of AJAX methods, since it's a way of obtaining data from a URL without refreshing the whole page. Every AJAX call makes use of the xmlHttpRequest object.

It is not subject to JQuery. In fact, JQuery, as most frameworks, is intended to simplify javascript methods. When you use JQuery's $.ajax() or $.get() or even $.post(), it is actually, behind the scenes, instantiating the core xmlHttpRequest and performing the request.

This methods are just simplifiers so you won't have to deal with all the arguments and parameters of making a http async request...

LcSalazar
  • 16,524
  • 3
  • 37
  • 69