AJAX XMLHttpRequest
The keystone of AJAX is the XMLHttpRequest object.
AJAX uses the XMLHttpRequest object
To get or send information from/to a database or a file on the server with
traditional JavaScript, you will have to make an
HTML form, and a user will have to click
the "Submit" button to send/get the information, wait for the server to respond, then a new page will load with the
results. Because the server returns a new page each
time the user submits input, traditional web applications can
run slowly and tend to be less user-friendly.
With AJAX, your JavaScript communicates directly with the server, through the
JavaScript XMLHttpRequest object.
With the XMLHttpRequest object, a web page can make a request to, and get a response from a web
server - without reloading the page. The user will stay on the same page, and he
or she will
not notice that scripts request pages, or send data to a
server in the background.
The XMLHttpRequest object is supported in all major browsers (Internet Explorer,
Firefox, Chrome, Opera, and Safari).
AJAX - Browser support
All new browsers use the built-in JavaScript XMLHttpRequest object to create
an XMLHttpRequest object (IE5 and IE6 uses an ActiveXObject).
The JavaScript code for creating an XMLHttpRequest object:
if (window.XMLHttpRequest)
{
// code for IE7+, Firefox, Chrome, Opera, Safari
return new XMLHttpRequest();
}
if (window.ActiveXObject)
{
// code for IE6, IE5
return new ActiveXObject("Microsoft.XMLHTTP");
} |
The next chapter shows how to use the XMLHttpRequest object to communicate with
a PHP server.
More about the XMLHttpRequest object
If you want to read more about the XMLHttpRequest, visit our
AJAX tutorial.
Make your web applications look like a million bucks
|
|
Most web applications today use boring methods to present data to their viewers using grids or simple HTML tables. FusionCharts induces "life" into the web applications by converting monotonous data into lively charts, gauges & maps.
FusionCharts works with all technologies like ASP, ASP.NET, PHP, ColdFusion, Ruby on Rails, JSP, HTML pages etc.
and connects to any database to render animated & interactive charts. It takes less than 15 minutes and no expertise
whatsoever to build your first chart and just a glance of it to captivate your audience. This fact is endorsed by our
12,000 customers and 150,000 users which include a majority of the Fortune 500 companies.
And yeah, your applications could look like a million bucks by spending just $69.
So go ahead, download your
copy of FusionCharts and start "wow-ing" your customers now!
|
 |
W3Schools' Online Certification Program
The perfect solution for professionals who need to balance work, family, and career building.
More than 4000 certificates already issued!
|
The HTML Certificate documents your knowledge of HTML, XHTML, and CSS.
The JavaScript Certificate documents your knowledge of JavaScript and HTML DOM.
The XML Certificate documents your knowledge of XML, XML DOM and XSLT.
The ASP Certificate documents your knowledge of ASP, SQL, and ADO.
The PHP Certificate documents your knowledge of PHP and SQL (MySQL).
|