Sie sind auf Seite 1von 2

8/8/13

AJAX Example
Search w3schools.com: Select Language

HOME

HTML

C SS

JAVASC RIPT

JQUERY

XML

ASP.NET

PHP

SQL

MORE...

R EFER ENC ES

EXAMPLES

FO R UM

ABO UT

Get Certified
Study Web Technologies and get a diploma at w3schools.com

SHARE THIS PAGE

Like

77k

AJAX Basic
AJAX HOME AJAX Intro AJAX Example

AJAX Example
Previous
To understand how AJAX works, we will create a small AJAX application: Example

WEB HOSTING

Next Chapter

Best Web Hosting eUK Web Hosting UK Reseller Hosting Domain, Hosting & Email

AJAX XMLHttpRequest
XHR Create Object XHR Request XHR Response XHR readyState

WEB BUILDING

A J A Xi sn o tan e wp r o g r a m m i n gl a n g u a g e . A J A Xi sat e c h n i q u ef o rc r e a t i n gf a s ta n dd y n a m i cw e bp a g e s .

Download XML Editor FREE Website BUILDER FREE Website C reator Best Website Templates

AJAX Advanced
AJAX ASP/PHP AJAX Database AJAX XML File

Change Content
Try it yourself

STATISTICS
Browser Statistics

AJAX Examples
AJAX Examples

AJAX Example Explained


The AJAX application above contains one div section and one button. The div section will be used to display information returned from a server. The button calls a function named loadXMLDoc(), if it is clicked:

OS Statistics Display Statistics

< ! D O C T Y P Eh t m l > < h t m l > < b o d y > < d i vi d = " m y D i v " > < h 2 > L e tA J A Xc h a n g et h i st e x t < / h 2 > < / d i v > < b u t t o nt y p e = " b u t t o n "o n c l i c k = " l o a d X M L D o c ( ) " > C h a n g eC o n t e n t < / b u t t o n > < / b o d y > < / h t m l >
Next, add a <script> tag to the page's head section. The script section contains the loadXMLDoc() function:

< h e a d > < s c r i p t > f u n c t i o nl o a d X M L D o c ( ) { . . . .A J A Xs c r i p tg o e sh e r e. . . } < / s c r i p t > < / h e a d >


The next chapters will explain how AJAX works.

Previous

Next Chapter

Book Your Air Ticket


Round Trip Leaving From: Going To:
-----------------------------

One Way Passengers:


1

Depart Date:
8 Aug 2013

Return Date:
8 Aug 2013

Top 10 Tutorials
HTML Tutorial HTML5 Tutorial C SS Tutorial C SS3 Tutorial JavaScript Tutorial jQuery Tutorial SQL Tutorial PHP Tutorial ASP.NET Tutorial

Top 10 References
HTML/HTML5 Reference C SS 1,2,3 Reference C SS 3 Browser Support JavaScript HTML DOM XML DOM PHP Reference jQuery Reference ASP.NET Reference

Examples
HTML Examples C SS Examples XML Examples JavaScript Examples HTML DOM Examples XML DOM Examples AJAX Examples ASP.NET Examples Razor Examples

Quizzes
HTML Quiz HTML5 Quiz XHTML Quiz C SS Quiz JavaScript Quiz jQuery Quiz XML Quiz ASP Quiz PHP Quiz

Color Picker

Statistics
Browser Statistics

w3schools.com/ajax/ajax_example.asp

1/2

8/8/13
XML Tutorial HTML C olors

AJAX Example
ASP Examples SVG Examples SQL Quiz Browser OS Browser Display

RE P O RT E RRO R

HO ME

TO P

P RI N T

FO RU M

A BO U T

A D V E RT I SE WI T H U S

W3Schools is optimized for learning, testing, and training. Examples might be simplified to improve reading and basic understanding. Tutorials, references, and examples are constantly reviewed to avoid errors, but we cannot warrant full correctness of all content. While using this site, you agree to have read and accepted our terms of use and privacy policy. C opyright 1999-2013 by Refsnes Data. All Rights Reserved.

w3schools.com/ajax/ajax_example.asp

2/2

Das könnte Ihnen auch gefallen