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

AJAX DWR

ʹÓÃԭʼµÄXMLHttpRequest·¢³öÇëÇóʱ,Ö»ÄܶÔServletºÍJSP²Ù×÷
ÔÚJSPÖд´½¨3¸öfunction
1.createXmlHttpRequest----¸ºÔðÅжÏä¯ÀÀÆ÷ÀàÐÍ´´½¨ XMLHttpRequest¶ÔÏó
 var xmlHttpRequest;
 function createXMLHttpRequest(){
   // IE ä¯ÀÀÆ÷
   if(window.ActiveXObject){
          return new ActiveXObject("Microsoft.XMLHTTP");
      }else if(window.XMLHttpRequest){
       // ·ÇIEä¯ÀÀÆ÷
          return new XMLHttpRequest();
      }
   
  }
2.doLogin------¸ºÔð¸ü¼Ó´´½¨ºÃµÄXMLHttpRequest¶ÔÏó·¢³öÇëÇó
 function doLogin(obj){
   var url = "servlet/LoginServlet?userName="+obj.value;
   
   // 1. ´´½¨XMLHttpRequest×é¼þ
   xmlHttpRequest = createXMLHttpRequest();
   // 2. ÉèÖûص÷º¯Êý
   xmlHttpRequest.onreadystatechange = haoLeJiaoWo;
   // 3. ³õʼ»¯XMLHttpRequest×é¼þ
   // ʹÓÃget·½·¨µ÷ÓÃURL,true´ú±íÊÇÒì²½µÄ
   xmlHttpRequest.open("GET",url,true);
   // 4. ·¢ËÍÇëÇó
   xmlHttpRequest.send(null);
   alert("123");
   
  }
3.haolejiaowo---¸ºÔð½øÐлص÷´¦Àí
function haoLeJiaoWo(){
   // readyState-- =4±íʾµÃµ½ÁË·µ»Ø½á¹û
   // status=200 ±íʾ³É¹¦¶øÇÒ²»³ö´í
   /*
    ÇëÇó״̬£º
    0 -- δ³õʼ»¯
    1 -- ³õʼ»¯
    2 -- ·¢ËÍÇëÇó
    3 -- ¿ªÊ¼½ÓÊܽá¹û
    4 -- ½ÓÊܽá¹ûÍê±Ï
    Ã¿´Î״̬¸Ä±ä¶¼»áµ÷Õâ¸öº¯Êý
    
   */
   if(     xmlHttpRequest.readyState == 4   &


Ïà¹ØÎĵµ£º

AJAX¼¯³ÉÓÚASP.NET

APS.NETÒ¹»°µÄÀý×Ó¼ÓÔغ󱨴íÈçÏ£º
System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35´íÎó
Ô­ÒòÊÇδÄܼÓÔØÎļþ»ò³ÌÐò¼¯ system.web.extensions
½â¾ö°ì·¨:
1,Èç¹ûÄãµÄ³ÌÐòÔËÐÐÔÚÄãÄÜ¿ØÖƵķþÎñÆ÷ÉÏ£¬ÄÇô°²×°asp.net ajax¾ÍÐÐÁË£¬ÕâÊÇSystem.Web.ExtensionsµÈdll×öΪGAC² ......

AJAXÖÐDragPanelExtenderÀ©Õ¹¿Ø¼þ


Ò³Ãæ´úÂ룺
<head runat="server">
    <title>ÎÞ±êÌâÒ³</title>
</head>
<body>
    <form id="form1" runat="server">
    <div>
        <asp:ScriptManager ID="ScriptManage ......

Ajax µÄ״̬½éÉÜ

ÔÚ¡¶Pragmatic Ajax A Web 2.0 Primer ¡·ÖÐżȻ¿´µ½¶ÔreadyStae״̬µÄ½éÉÜ£¬¸Ð¾õÕâ¸ö½éÉܺÜʵÔÚ£¬ÕªÒëÈçÏ£º
0: (Uninitialized) the send( ) method has not yet been invoked.
1: (Loading) the send( ) method has been invoked, request in progress.
2: (Loaded) the send( ) method has completed, entire respons ......

asp.netÔÚÓÃajaxµÄʱºòÈçºÎµ¯³ö¶Ô»°¿ò


<form id="form1" runat="server">
    <asp:ScriptManager ID="ScriptManager1" runat="server">
    </asp:ScriptManager>
    <div>
    <asp:updatepanel ID="UP" runat="server">
      <ContentTemplate>
......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ