ÍøÂçѧԺ w3popÉçÇø ÍøÂç×ÊÔ´ ITÐÂÎÅ

w3pop.com :: ÍøÂçѧԺ :: AJAX :: AJAX HTTP ÇëÇó

»áÔ±µÇ½

ÕʺÅ

ÃÜÂë

»Ø´ð

¼ÇסÃÜÂë

Íü¼ÇÃÜÂë? ×¢²á

AJAX
AJAX ʵÀý
AJAXä¯ÀÀÆ÷
AJAXÔ´´úÂë
AJAX·þÎñ¶Ë
AJAX Êý¾Ý¿â
AJAXÓëXMLÎļþ
AJAX XMLHttpRequ..
΢ÈíµÄAjax
AJAX ½éÉÜ
AJAX HTTP ÇëÇó
AJAX ·þÎñÆ÷¶Ë½Å±..
AJAX Suggest °¸À..
AJAX ResponseXML
AJAX AppML

AJAX HTTP ÇëÇó


×÷Õß:w3pop.com ·­Òë/ÕûÀí:w3pop.com ·¢²¼:2007-08-22 ä¯ÀÀ:2218 :: ::

AJAX Uses HTTP Requests
AJAX ʹÓà HTTP ÇëÇó

In traditional JavaScript coding, if you want to get any information from a database or a file on the server, or send user information to a server, you will have to make an HTML form and GET or POST data to the server. The 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.
ÔÚ´«Í³µÄ JavaScript ´úÂëÖУ¬Èç¹ûÄãÏ£Íû´Ó·þÎñÆ÷¶ËµÄÊý¾Ý¿â»òÎļþÖлñÈ¡ÐèÒªµÄÐÅÏ¢£¬»òÕßÏò·þÎñÆ÷¶Ë·¢ËÍÐÅÏ¢£¬Äã¾Í±ØÐë´´½¨Ò»ÕÅHTML±íµ¥£¬È·¶¨Ê¹ÓÃGET·½·¨»¹ÊÇPOST·½·¨Ïò·þÎñÆ÷¶Ë·¢ËÍÊý¾Ý£»Óû§±ØÐëµã»÷ “Submit [ Ìá½» ]” °´Å¥½øÐÐÐÅÏ¢µÄ·¢ËÍ / »ñÈ¡£¬²¢µÈ´ý·þÎñÆ÷µÄ»ØÓ¦£¬´Ëʱ£¬ÇëÇóµÄ½á¹û½«»á±»¼ÓÔØµ½Ò»ÕÅȫеÄÒ³ÃæÖС£

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.
ͨ¹ýAJAX£¬Äã¿ÉÒÔʹÓÃJavaScriptµÄ XMLHttpRequest ¶ÔÏóʹJavaScriptÖ±½ÓÓë·þÎñÆ÷½øÐÐÐÅÏ¢½»»»¡£

With an HTTP request, 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.
ͨ¹ýHTTPÇëÇó£¬ÍøÒ³¿ÉÒÔÏò·þÎñÆ÷¶Ë·¢ËÍÇëÇó¡¢»ñÈ¡»ØÓ¦ÐÅÏ¢¶ø²»ÐèÒªÖØÐ¼ÓÔØÒ³Ãæ¡£Óû§½«»áÍ£ÁôÔÚÏàͬµÄÒ³ÃæÉÏ£¬²¢²»»á²ì¾õ½Å±¾³ÌÐòÕýÔÚÇëÇóÒ³Ãæ£¬ÒÔ¼°Ïò·þÎñÆ÷·¢ËÍÊý¾Ý¡£


The XMLHttpRequest Object
XMLHttpRequest ¶ÔÏó

By using the XMLHttpRequest object, a web developer can update a page with data from the server after the page has loaded!
ͨ¹ýʹÓà XMLHttpRequest ¶ÔÏó£¬ÍøÂ翪·¢Õß¿ÉÒÔÔÚ·þÎñÆ÷¶ËµÄÒ³Ãæ¼ÓÔØÖ®ºó¶ÔÒ³ÃæµÄÊý¾Ý½øÐиüС£

AJAX was made popular in 2005 by Google (with Google Suggest).
Google´Ó2005Ä꿪ʼƵ·±Ê¹ÓÃAJAX£¨Ö÷ÒªÊÇGoogle Suggest µÄÓ¦Óã©¡£

Google Suggest is using the XMLHttpRequest object to create a very dynamic web interface: When you start typing in Google's search box, a JavaScript sends the letters off to a server and the server returns a list of suggestions.
Google Suggest ʹÓÃXMLHttpRequest ¶ÔÏóÀ´´´½¨¼«¾ß¶¯Ì¬Ð§¹ûµÄweb½çÃæ£ºµ±ÄãÔÚGoogleµÄËÑË÷¿òÖпªÊ¼ÊäÈëÐÅϢʱ£¬JavaScript»á½«×Öĸ·¢Ë͵½·þÎñÆ÷¶Ë£¬·þÎñÆ÷Ôò»á·µ»Ø°üº¬¸Ã×ÖĸµÄÐÅÏ¢ÌáʾÁÐ±í¡£

The XMLHttpRequest object is supported in Internet Explorer 5.0+, Safari 1.2, Mozilla 1.0 / Firefox, Opera 8+, and Netscape 7.
Internet Explorer 5.0+¡¢Safari 1.2¡¢Mozilla 1.0 / Firefox¡¢Opera 8+¡¢Netscape 7¶¼Ö§³ÖXMLHttpRequest ¶ÔÏó¡£

ÆÀÂÛ (0) All