Ò׽ؽØͼÈí¼þ¡¢µ¥Îļþ¡¢Ãâ°²×°¡¢´¿ÂÌÉ«¡¢½ö160KB

AjaxµÄÒì²½ºËÐÄ£ºXMLHTTPRequest

    XMLHTTPRequestÊÇÒÀ¸½ÓÚä¯ÀÀÆ÷µÄÒ»¸ö×é¼þ£¬ä¯ÀÀÆ÷²»Í¬Õë¶ÔµÄ×é¼þÃû³ÆÒ²²»Í¬¡£XMLHTTPRequestÊÇFirefoxÖÐ×é¼þµÄÃû³Æ£¬ÔÚIEÖнÐXMLHTTP¡£“XMLHTTP”ÓÐÁ½¸öÓŵ㣺¾Ö²¿Ë¢Ð¡¢Òì²½¶ÁÈ¡¡£
AjaxµÄʵÏÖ²½Ö裺
1¡¢ ´´½¨Òì²½¶ÔÏó£º
ÔÚIEÖУºvar xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
ÔÚFirefoxÖУºvar xmlhttp = new XMLHttpRequest;
2¡¢ ¼ÓÔØÊý¾ÝËùÔڵķþÎñÆ÷£º
Ajax»ñÈ¡Êý¾Ý¿ÉÒÔ´ÓÆäËûÍøÕ¾»ñÈ¡£¬Ò²¿ÉÒÔ´Ó±¾µØµÄXMLÎļþ»ñÈ¡£¬¼ÓÔØÊý¾Ý·þÎñÆ÷µÄÓï·¨£ºxmlhttp.open(method, url, aysc);
method£º±íʾÏò·þÎñÆ÷·¢ËÍÇëÇóµÄ·½·¨£¬ÓÐ5ÖÖÀàÐÍ£ºGET¡¢POST¡¢HEAD¡¢PUT¡¢DELETE¡£×î³£ÓõÄÊÇGETºÍPOST¡£ ×¢Ò⣺Èç¹ûÊý¾Ý´¦Àí²»¸Ä±äÄ£Ð͵Ä״̬£¨±ÈÈç»ñÈ¡Êý¾Ý£©¾ÍÓÃGET£¬Èç¹û±à¼­¡¢¸üÐÂÊý¾ÝµÈ£¬ÔòÓÃPOST¡£
Aysc±íʾÊÇ·ñʹÓÃÒì²½·½Ê½»ñÈ¡Êý¾Ý£¬Èç¹ûÊÇtrue£¬ÔòXMLHTTP½«Òì²½µ÷ÓöÔÏó¡£
3¡¢ Òì²½µ÷Ó÷þÎñÆ÷״̬µÄ±ä»¯£º
Ò»µ©·þÎñÆ÷Óë¿Í»§¶Ë½øÐн»»¥£¬Òª¿ØÖÆ¿Í»§¶ËµÄ±ä»¯£¬¾ÍÐèÒªÅжÏÄ¿Ç°½»»¥µÄ״̬¡£ËùÒÔÔÚÒì²½µ÷ÓÃ֮ǰÐèÒª½«×´Ì¬±ä»¯µÄʼþonreadystatechangeÓëjavascript¶¨ÒåµÄ·½Ê½¹Ò¹³¡£
xmlhttp.onreadystatechange = ·½·¨Ãû;  ×¢Ò⣺·½·¨ºóÃæ²»¼ÓÀ¨ºÅ¡£
ÏÂÃæÊÇÒì²½µ÷ÓÃÔÚÓë·þÎñÆ÷½»»¥Ê±µÄ5ÖÖ״̬£º
0   δ³õʼ»¯          Òì²½¶ÔÏó´´½¨Íê±Ï£¬²¢Î´Ê¹ÓÃopen·½·¨¡£
1   ³õʼ»¯            Òì²½¶ÔÏó´´½¨Íê±Ï£¬²¢Î´Ê¹ÓÃsend·½·¨·¢ËÍÇëÇó¡£
2   ·¢ËÍÊý¾Ý          send·½·¨Íê³É£¬ÕýÔڵȴý·þÎñÆ÷ÏìÓ¦¡£
3   Êý¾ÝÕýÔÚ·¢ËÍ      ÕýÔÚ½ÓÊÜÊý¾Ý£¬µ«²¢Î´Íê³É¡£
4   Òì²½µ÷ÓÃÍê³É      µ÷ÓÃÍê³É£¬¿ÉÒÔʹÓÃresponseText»îresponseXML»ñÈ¡Êý¾Ý¡£
 
4¡¢ ·¢ËÍÒ»¸öHTTPÇëÇó£º
¼ÓÔØÍêÇëÇóµÄ·þÎñÄÚÈݺ󣬻¹ÐèÒª·¢ËÍÒ»¸öHTTPÇëÇó£¬Ò»°ã±íʾÇëÇóµÄÊý¾Ý¡£Í¨¹ý·¢ËÍÇëÇóʱÉèÖõIJÎÊý£¬À´ÓÐÑ¡ÔñµÄÌôÑ¡Êý¾Ý£º
xmlhttp.send(params);
µ±ÏµÍ³µ÷ÓÃsend·½·¨ºó£¬ºǫ́Óë·þÎñÆ÷µÄ½»»¥²ÅÕæÕý¿ªÊ¼£¬×´Ì¬±àºÅ¾Í¿ªÊ¼±ä»¯¡£
5¡¢ ´¦ÀíÒì²½»ñÈ¡µÄÊý¾Ý£º
×îÖÕ¿Í»§¶Ë»ñÈ¡µÄÊý¾ÝÖ÷ÒªÓÐÁ½ÖÖ£ºÎı¾ÐͺÍXMLÀàÐÍ¡£Îı¾ÐÍÊý¾ÝÓÃxmlhttp.responseText»ñÈ¡£»XMLÀàÐÍʹÓÃxmlhttp.responseXML»ñÈ¡¡£
ÏÂÃæ¾ÙÒ»¸öʹÓÃA


Ïà¹ØÎĵµ£º

ASP.NET AJAX¿Í»§¶Ë±à³ÌÖ®Âã¨Ò»£©

ÕªÒª
      ±¾ÎĽ«Ê×ÏȽéÉÜÒ»ÏÂÎÄÕµÄд×÷±³¾°ºÍÓõ½µÄÏà¹Ø¼¼Êõ¡£È»ºó½«·Ö±ðʹÓÃÆÓËصÄAjax¼¼ÊõºÍASP.NET AJAX¿ò¼Ü·Ö±ðʵÏÖ¾­µäµÄ“Hello£¡XX”£¬Í¨¹ýÁ½¸öСÀý×Ó£¬Ê¹ÅóÓÑÃǶÔÕâ¸ö¿ò¼ÜµÄÌصãºÍ¿ò¼ÜµÄʹÓ÷½·¨ÓÐÒ»¸ö³õ²½µÄÈÏʶ¡£
Ç°ÑÔ
      ÎÒÏ룬Èç¹û½ñÌìÄ ......

AJAX ¿ò¼ÜJqueryµÄʹÓ÷½·¨

 AJAX Á÷ÐÐÖ®ºó£¬×ÜÏëºÃºÃѧϰһÏ¡£µ«ÊÇÖÚ¶àµÄ¿ò¼ÜʵÔÚÄÑÒÔÑ¡Ôñ¡£ËµÃ÷һϠASP.NET AJAX ²¢²»°üÀ¨ÔÚ AJAX ¿ò¼ÜÖ®ÖС£
¸Õ¿ªÊ¼Ñ§ÁË JQuqery£¬ ÖÚ¶àµÄ $get(),...µÈµÈ·ûºÅÔçÒÑ°ÑÎÒ¸ãÔÎÁË¡£ÔÝʱ¾Í·ÅÆúÁË¡£
ºóÀ´Ñ§Ï° ASP.NET AJAX £¬ÔÚ΢ÈíµÄÁ쵼ϣ¬Öð½¥ÓÉ·þÎñÆ÷¶ËתÏò¿Í»§¶Ë±à³Ì¡£ ¼¤ÆðÎÒ¿Í»§¶Ë±à³ÌµÄÐËȤ£¬
²ÅÏëÆðѧ ......

΢ÈíÐû²¼AJAX CDN

 Ô­ÎĵØÖ·¡¿Announcing the Microsoft AJAX CDN
¡¾Ô­ÎÄ·¢±íÈÕÆÚ¡¿ Tuesday, September 15, 2009 11:46 PM
½ñÌìÔçЩʱºò£¬ASP.NET¿ª·¢ÍŶÓÍƳöÁËÒ»¸öеÄ΢ÈíAjax CDN£¨Content Delivery Network£¬ÄÚÈÝ·Ö·¢ÍøÂ磩·þÎñ£¬¸Ã·þÎñÌṩÁ˶ÔAJAX¿â£¨°üÀ¨jQuery ºÍ ASP.NET AJAX£©µÄ»º´æÖ§³Ö¡£¸Ã·þÎñÊÇÃâ·ÑµÄ£¬²»ÐèÈκÎ×¢² ......

³õʶAjax¼¼Êõ2


 ÊµÏÖ×¢²á½çÃæÎÞË¢ÐÂÅжÏÖØÃû£¬ÓÉÓÚÒª·ÃÎÊÊý¾Ý¿â£¬ËùÒÔÒª´ïµ½ÎÞˢУ¬Ö»ÄÜÓÃAjax¼¼Êõ¡£
 ÆäÖÐ×îÖØÒªµÄ¾ÍÊÇxmlHttp¶ÔÏó¡£
XmlHttpÊÇʲô£¿
×îͨÓõĶ¨ÒåΪ£ºXmlHttpÊÇÒ»Ì׿ÉÒÔÔÚJavascript¡¢VbScript¡¢JscriptµÈ½Å±¾ÓïÑÔÖÐͨ¹ýhttpЭÒé´«ËÍ»ò´Ó½ÓÊÕXML¼°ÆäËûÊý¾ÝµÄÒ»Ì×API¡£XmlHttp×î´óµÄÓô¦ÊÇ¿ÉÒÔ¸üÐÂÍøÒ³µ ......

c#ÖеÄAjaxÉÏÊÖƪ£­£­£­JSONµÄ´«ËÍÓë½ÓÊÕ

±¾ÆªÎÄÕÂÖ÷Òª½éÉÜÈçºÎÔÚAjaxµÄ¿Í»§¶ËÓë·þÎñ¶ËÖ®¼ä´«ËÍJSON¸ñʽµÄÊý¾Ý¡£ÄÇôÎÒÃÇÏÈÀ´ËµËµÊ²Ã´ÊÇJSON°É¡£
JSON£¬¼´ÊÇJavaScript¶ÔÏó±ê¼Ç·¨£¬Ó¢ÎÄÃû³ÆÊÇJavaScript Object Notation£¬¼ò³ÆJSON
£¬ÊÇ JavaScript Programming Language,
Standard
ECMA-262 3rd Edition - December 1999
µÄ×Ó¼¯ºÏ£¬ÊÇ´ÓJavaScriptµÄo ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ