Ò׽ؽØͼÈí¼þ¡¢µ¥Îļþ¡¢Ãâ°²×°¡¢´¿ÂÌÉ«¡¢½ö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² ......

jQuery Ajax»º´æÎÊÌâ

ÔÚʹÓÃjQuery µÄAjax¼ÓÔØÊý¾ÝÊÇ Èç¹ûʹÓÃget·½Ê½´«µÝ²ÎÊýÔò´æÔÚÒ»ÏÂÎÊÌâ
firefoxÏ´«µÝÊý¾ÝÕý³£
ieÏÂÔò»á³öÏÖ»º´æÎÊÌâ
½â¾ö·½·¨£º
1¡¢http://yourwebsite?parseInt(Math.random() * 1000) ÔÚurlºóÃæ¼ÓÉÏÒ»¸öËæ¼´Êý£¬ÕâÑùÿ´Î·¢Ë͵ľͲ»Ò»ÑùÁË£¬¶øÇÒ²»Ó°ÏìÄãµÄ¹¦ÄÜ.
2¡¢Ê¹ÓÃpost´«µÝ²ÎÊý
......

Asp.net AJAX Web Serviceд·¨²îÒì

ÔÚC#ÖÐ
using System;
using System.Web;
using System.Web.Services;
using System.Web.Services.Protocols;
using System.Web.Script.Services;
using System.Collections.Generic;
using System.Collections;
[WebService(Namespace = "http://tempuri.org/")]
[WebServiceBinding(ConformsTo = WsiProfiles.Ba ......

ajax XMLHttpRequest post get

/*ÔÚÓÐÖÐÎIJÎÊýʱ,½ÓÊÕ·½ÐèҪʹÓÃUTF-8·½Ê½¶ÔÊý¾Ý½øÐнâÂë
*²»Ö§³Öpost¸½¼þ
*/
function getXmlHttpRequest() {
    var xmlHttpRequest = null;
    try {
        xmlHttpRequest = new ActiveXObject("Msxml2.XMLHTTP");
    } ......

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 ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ