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

Ajax½éÉÜ XMLHttpRequest

Ajax½éÉÜ
AJAX - ä¯ÀÀÆ÷Ö§³Ö
AJAX µÄÒªµãÊÇ XMLHttpRequest ¶ÔÏó¡£²»Í¬µÄä¯ÀÀÆ÷´´½¨ XMLHttpRequest ¶ÔÏóµÄ·½·¨ÊÇÓвîÒìµÄ¡£IE ä¯ÀÀÆ÷ʹÓà ActiveXObject£¬¶øÆäËûµÄä¯ÀÀÆ÷ʹÓÃÃûΪ XMLHttpRequest µÄ JavaScript ÄÚ½¨¶ÔÏó¡£ÈçÐèÕë¶Ô²»Í¬µÄä¯ÀÀÆ÷À´´´½¨´Ë¶ÔÏó£¬ÎÒÃÇҪʹÓÃÒ»Ìõ "try and catch" Óï¾ä¡£
<script type="text/javascript">
function ajaxFunction()
 {
 var xmlHttp;
 try{
xmlHttp=new XMLHttpRequest();// Firefox, Opera 8.0+, Safari
}
 catch (e) {
   try{
      xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");// Internet Explorer 6.0+
      }
   catch (e) {
      try{
         xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");// Internet Explorer 5.5
         }
      catch (e) {
         alert("ÄúµÄä¯ÀÀÆ÷²»Ö§³ÖAJAX£¡");
         return false;}
      }}
 }
</script>
ÉùÃ÷Ò»¸ö±£´æ XMLHttpRequest ¶ÔÏóµÄ xmlHttp ±äÁ¿¡£È»ºóʹÓà XMLHttp=new XMLHttpRequest() À´´´½¨´Ë¶ÔÏó¡£ÕâÌõÓï¾äÕë¶Ô Firefox¡¢Opera ÒÔ¼° Safari ä¯ÀÀÆ÷¡£¼ÙÈçʧ°Ü£¬Ôò³¢ÊÔInternet Explorer 6.0+ µÄ xmlHttp=new ActiveXObject("Msxml2.XMLHTTP")£¬¼ÙÈçÒ²²»³É¹¦£¬Ôò³¢ÊÔInternet Explorer 5.5+ µÄ xmlHttp=new ActiveXObject("Microsoft.XMLHTTP")¡£¼ÙÈçÕâÈýÖÖ·½·¨¶¼²»Æð×÷Óã¬ÄÇôÕâ¸öÓû§ËùʹÓõÄä¯ÀÀÆ÷ÒѾ­Ì«¹ýʱÁË£¬Ëû»òËý»á¿´µ½Ò»¸öÉùÃ÷´Ëä¯ÀÀÆ÷²»Ö§³Ö AJAX µÄÌáʾ¡£
AJAX - XMLHttpRequest¶ÔÏó
onreadystatechange ÊôÐÔ
onreadystatechange ÊôÐÔ´æÓд¦Àí·þÎñÆ÷ÏìÓ¦µÄº¯Êý¡£ÏÂÃæµÄ´úÂ붨ÒåÒ»¸ö¿ÕµÄº¯Êý£¬¿Éͬʱ¶Ô onreadystatechange ÊôÐÔ½øÐÐÉèÖãº
xmlHttp.onreadystatechange=function()
  {
  // ÎÒÃÇÐèÒªÔÚÕâÀïдһЩ´úÂë
  }
readyState ÊôÐÔ
readyState ÊôÐÔ´æÓзþÎñÆ÷ÏìÓ¦µÄ״̬ÐÅÏ¢¡£Ã¿µ± readyState ¸Ä±äʱ£¬onreadystatechange º¯Êý¾Í»á±»Ö´ÐС££¨ÏêÇé²Î¼û AJAX – readyStateÏêÇ飩
״̬
ÃèÊö


Ïà¹ØÎĵµ£º

Ïê½âAJAXºËÐÄÖеÄXMLHttpRequest¶ÔÏó

 XMLHttpRequest ¶ÔÏóÊÇAJAX¹¦ÄܵĺËÐÄ£¬Òª¿ª·¢AJAX³ÌÐò±ØÐë´ÓÁ˽âXMLHttpRequest ¶ÔÏó¿ªÊ¼¡£
    Á˽âXMLHttpRequest ¶ÔÏó¾ÍÏÈ´Ó´´½¨XMLHttpRequest ¶ÔÏó¿ªÊ¼£¬ÔÚ²»Í¬µÄä¯ÀÀÆ÷Öд´½¨XMLHttpRequest ¶ÔÏóʹÓò»Í¬µÄ·½·¨£º
    ÏÈ¿´¿´IE´´½¨XMLHttpRequest ¶ÔÏóµÄ·½·¨£¨·½·¨1£©£º
va ......

ASP.NET,AJAXÎļþÉÏ´«µÄÒÉÎÊ¡£

ASP.NET,AJAXÎļþÉÏ´«µÄÒÉÎÊ
Ô­±¾ÒÔΪÓÃÕâÖÖ·½Ê½£¬°Ñ´Ë·½·¨·Åµ½Ò»¸öHttphandlerÖУ¬È»ºó´ÓJAVASCRIPT·ÃÎÊHttphandlerÀ´ÊµÏÖÎÞˢеÄÎļþÉÏ´«¡£Ã»Ïëµ½£¬ÕâÑùͬÑùÊDz»Ðеģ¬Ö»ÄÜÔÚ±¾»ú²âÊÔͨ¹ý£¬Èç¹û·Åµ½ÍøÉÏ£¬»òÕß´ÓÆäËûµØ·½·ÃÎʾͻáÌáʾÎÞ·¨ÕÒµ½Îļþ£¬¿É¼ûÔÚASP.NETÖÐËüÖ»ÄÜÓÃÓÚÉÏ´«·þÎñÆ÷¶ËµÄÎļþ¡£ 
֮ǰÔÚÍøÕ¾Ò²Ë ......

php¼ì²âajax·½Ê½µÄµ÷ÓÃÇëÇó

±ÈÈçÒª¸øÓû§±¨¸æÒ»¸ö´íÎó£¬ÓÃÏÂÃæµÄ·½·¨£º
ʹÓÃset_error_handlerÉèÖÃ×Ô¼ºµÄ´íÎó´¦Àíº¯Êý£¬ÔÚ±¨´íµÄµØ·½Ê¹ÓÃtrigger_error£¬ÔÚ×Ô¶¨ÒåµÄ´íÎó´¦Àíº¯ÊýÖиøÓû§ÏÔʾһ¸ö³ö´íÐÅÏ¢Ò³Ãæ¡£
µ«
ÊÇÈç¹ûµ÷ÓÃtrigger_errorµÄÕâ¸öÒ³ÃæÊDZ»Ò»´ÎajaxÇëÇó´¥·¢µÄ£¬ÄÇôajax·µ»Øºó½«µÃµ½Ò»´ó¶ÑÓÃÓÚÏÔʾ´íÎóµÄhtml´úÂë¡£¶øÒ»°ã
ajaxµ÷Óö ......

AJAX (Òì²½ JavaScript ºÍ XML)

AJAX (Òì²½ JavaScript ºÍ XML) ÊǸöвúÉúµÄÊõÓï,רΪÃèÊöJavaScriptµÄÁ½ÏîÇ¿´óÐÔÄÜ.ÕâÁ½ÏîÐÔ
ÄÜÔÚ¶àÄêÀ´Ò»Ö±±»ÍøÂ翪·¢ÕßËùºöÂÔ,Ö±µ½×î½üGmail, Google suggestºÍgoogle MapsµÄºá¿Õ³öÊÀ²ÅʹÈË
ÃÇ¿ªÊ¼Òâʶµ½ÆäÖØÒªÐÔ.
ÕâÁ½Ïî±»ºöÊÓµÄÐÔÄÜÊÇ:
* ÎÞÐèÖØÐÂ×°ÔØÕû¸öÒ³Ãæ±ãÄÜÏò·þÎñÆ÷·¢ËÍÇëÇó.
* ¶ÔXMLÎĵµµÄ½âÎöºÍ´¦Àí£® ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ