AJAXС½á
Ô³ö´¦:http://blog.163.com/zwx_gis/blog/static/32434435200971072634757/
Web±à³ÌÏà¹Ø 2009-08-10 19:26 ÔĶÁ15 ÆÀÂÛ0
Ajax (Asynchronous JavaScript and XML) ÊǶàÖÖ¼¼ÊõµÄ¼¯ºÏ£¬°üÀ¨JavaScript¡¢XHTML¡¢CSS¡¢DOM¡¢XML¡¢XSTL¡¢XMLHttpRequestµÈ£¬ÆäÖÐXHTMLºÍCSS ʵÏÖ±ê×¼»¯³ÊÏÖ£¬DOM ¸ºÔðÊý¾ÝµÄ¶¯Ì¬ÏÔʾºÍ½»»¥£¬XMLºÍXSTL½øÐÐÊý¾Ý½»»»ºÍ´¦Àí£¬ JavaScript¸ºÔð²Ù×÷XMlHttpRequest¶ÔÏóÀ´¸úÊý¾Ý¿â´ò½»µÀ£¬XMLHttpRequest¸ºÔðÊý¾ÝµÄÒì²½»ñÈ¡¡£
Óŵ㣺ÎÞË¢ÐÂÇëÇó´¦ÀíÊý¾Ý¡£
ȱµã£ºÒªÇóIE5.0,Mozilla1.0,NetScape7ÒÔÉÏ£»
¸üÐÂÒ³ÃæÄÚÈÝʱûÓÐË¢ÐÂÕû¸öÒ³Ã棬¹ÊºóÍ˹¦ÄÜÊÇʧЧµÄ£»
¶ÔÁ÷ýÌåºÍPDAÖ®ÀàµÄÖ§³Ö²»ÊǺܺá£
Ò»¡¢ºËÐĶÔÏó£ºXMLHttpRequest¶ÔÏó£¨ÊÇXMLHTTP×é¼þµÄ¶ÔÏ󣩡£
Ò»¸öÒ³Ãæ¿ÉÒÔͨ¹ýÒ»¸öHttpRequest·¢ËÍÒ»¸öÇëÇóÀ´»ñÈ¡·þÎñÆ÷ÏìÓ¦£¬¶øµ±Ç°Ò³Ãæ²»×öˢС£XMLHttpRequest¶ÔÏó²»ÊÇW3C±ê×¼£¬Ä¿Ç°Ö§³Ö´Ë¶ÔÏó²Ù×÷µÄä¯ÀÀÆ÷ÓУºIE5.0+¡¢Firefox¡¢Netscape7¡¢Mozilla1.0¡¢Safari1.2µÈ¡£
ÊôÐÔ£º
ÊôÐÔÃû
ÃèÊö
onreadystatechange
Ò»¸öʼþ£¬ÓÃÀ´²¶»ñËùÓеÄ״̬±ä»»,ͨ³£µ÷ÓÃjavascriptº¯Êý
readyState
·µ»Ø¶ÔÏó״̬£º
0 = uninitialized£¨Ã»Óгõʼ»¯£©
1 = loading£¨ÕýÔÚ¶ÁÈ¡ÖУ©
2 = loaded£¨ÒѶÁÈ¡£©
3 = interactive£¨½»»¥ÖУ©
4 = complete£¨Íê³É£©
responseText
ÏìÓ¦Îı¾£¬±íʾһ¸ö´®
responseXML
ÏìÓ¦XMLÊý¾Ý£¬¿ÉÒÔ½âÎöΪDOM¶ÔÏó
status
·µ»Ø·þÎñÆ÷״̬µÄÊý×Ö
404 = Not Found£¨Ã»·¢ÏÖ£©
200 = OK£¨³É¹¦£©
statusText
·µ»Ø״̬Îı¾£¨È磺“Not Found” £¬“OK”£©
·½·¨£º
·½·¨
ÃèÊö
open(
'GET/POST',
url,
true/flase,
user,passwd)
´ò¿ªÒ»¸öÇëÇó
get/post£ºÇëÇó·½·¨
url£ºÇëÇóµÄurl
true/flase:Òì²½/ͬ²½Ä£Ê½¡£¼´·¢ËÍÇëÇóºóÊÇ·ñµÈ´ý»ØÓ¦¶øÈ¥Ö´ÐбðµÄ²Ù×÷¡£
·ÃÎÊÓû§£¬·ÃÎÊÃÜÂ루¿ÉÑ¡£©
send(content)
Ïò·þÎñÆ÷·¢ËÍÇëÇó
¿ÉÒÔÊÇDOM¶ÔÏóµÄʵÀý¡¢ÊäÈëÁ÷£¬»òÕß´®
getAllResponseHeaders()
»ñÈ¡ÍêÕûµÄHttp headerÐÅÏ¢
°üÀ¨Content-Length¡¢Date¡¢url
getResponseHeader(headername)
»ñÈ¡Ö¸¶¨µÄHttp headerÐÅÏ¢
setRequestHeader("label","value")
ÉèÖÃÇëÇóÍ·²¿ÐÅÏ¢
ÔÚÉèÖÃÈκÎÍ·²¿Ö®Ç°±ØÐëÏȵ÷ÓÃ
Ïà¹ØÎĵµ£º
´Ó2005 ÄêWeb2.0 µÄÐËÆð¿ªÊ¼ËãÆð£¬Ajax °éËæ׏úÄÚµÄWeb ¿ª·¢ÉçÇø×ß¹ýÁ˽üËÄÄêµÄ³É³¤Ê±¼ä¡£ËÄÄêµÄʱ¼ä£¬¶ÔÓÚÒ»ÏîWeb ¼¼Êõ²»Ëã¶ÌÁË£¬Õâ²»½öÊǶԵ±³õ¶ÔAjax“¾ÉƿװоƔ³Ö²»Ð¼Ì¬¶ÈµÄÈ˵ķ´²µ£¬¸ü°Ñ¸ü¶à¹ÛÍûÖеĿª·¢ÕßÀÈëÁËWeb ¿ª·¢µÄÐÐÁС£
AjaxµÄ¿ò¼ÜÒ²¿ªÊ¼Ò»Ò»³öÏÖ£º
Buffalo ÊÇÏÖÈÎThought ......
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<script type="text/javascript&quo ......
Ò»¡¢Ç°ÑÔ
´ò¿ª¹¤¾ßÏäµÄAjax extensions¿ÉÒÔ¿´µ½Îå¸öajax¿Ø¼þ£¬ÔÚvs2008ÖÐËüÃÇÒѾ¼¯³Éµ½ÁË.net framerwork3.5ÖУ¬Èç¹ûÊÇ֮ǰ°æ±¾µÄvsÔòÐèÒª×Ô¼ºÈ¥ÏÂÔØÎļþÀ´°²×°¡£ÕâÎå¸ö¿Ø¼þÔÚajaxÖÐÊǷdz£³£Óõģ¬ËùÒÔ΢Èí²Å½«ËûÃǼ¯³Éµ½vsÖÐÀ´£¬ÏÂÃ潫¼òµ¥µÄ½éÉÜ×ÅÎå¸ö¿Ø¼þ¼°ËüÃǵÄÖØÒªÊôÐÔ¡£
¶þ¡¢ÖØÖÐÖ®ÖØ——Scrip ......
Ò»¡¢ н¨Ò»¸öAjax_StartµÄÍøÕ¾
¶þ¡¢ ÔÚÍøÕ¾ÖÐÌí¼ÓÒ»¸öweb·þÎñ£¨ws_start.asmx£©
ÔÚvs2008ÖУ¬Ìí¼ÓÒ»¸öweb·þÎñÉú³ÉÁËÁ½¸öÎļþ£¬Ò»¸öÊÇasmxÎļþ£¬Ò»¸öÊÇÔÚApp_codeÀïµÄcsÎļþ£»ÎÒ¾õµÃÕâÑù²¢²»ºÃ£¬Ö ......
ModalPopup ¿Ø¼þÔÊÐí½« Web Ò³ÃæÖеÄÒ»¸ö²¿·ÖÒÔÊÓ´°³ÌÐòÖеēģʽ”ÐÎʽÏÔ³öÀ´£¬Æðµ½ÌáʾÓû§²Ù×÷ºÍ±ÜÃâ¶ÔÒ³ÃæÖÐÆäËü²¿·ÖµÄÎó²Ù×÷µÄ×÷Óá£
“ģʽ”µÄÄÚÈÝ¿ÉÒÔÊÇÈÎÒâÒ»¸ö Control ÀàµÄÅÉÉú¿Ø¼þ£¬¿ª·¢ÈËÔ±¿ÉÒÔÖ¸¶¨µ±Ëü±»“ģʽ”ÏÔʾµÄʱºòµÄ±³¾°µÄÏÔʾÑùʽ¡£
µ±Ò»¸öÒ³Ãæ¿Ø¼þ±»&ld ......