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

AjaxÒ첽ˢÐÂ

×¢Òâ:
1¡¢<div id="iframe">ÏÔʾˢеÄÄÚÈÝ</div>
2¡¢µ÷ÓÃÒ첽ˢÐÂ:javascript:OnLink('µØÖ·')
<!--ajaxÒ첽ˢÐÂ-->
<script type="text/javascript">
 //´´½¨XMLHttpRequestc¶ÔÏó
  var  xmlHttp=false;
  //ÅжÏä¯ÀÀÆ÷
  function createXMLHttpRequest(){
    if(window.ActiveXObject){//IEä¯ÀÀÆ÷
      try{
        xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
      }catch(e){
        try{
          xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
        }catch(e){}
      }
    }else{//ÆäËûä¯ÀÀÆ÷£ºÈçmozilla µÄ fireFox(»ðºü) »òÕß netscape 7
      xmlHttp=new XMLHttpRequest();
    }
  }
  //Ìá½»»ñµÃÖµºóµÄ·½·¨
  function OnShow(){
   if(xmlHttp.readyState==4){
       if(xmlHttp.status==200){
         var info=xmlHttp.responseText;
      document.getElementById("iframe").innerHTML=info;
      }
    }
  }
  //Òªµ÷Óõķ½·¨
  function OnLink(URL){
   createXMLHttpRequest();
   xmlHttp.open("post",URL,true);
    xmlHttp.onreadystatechange=OnShow;
     xmlHttp.send(null);
  }
 </script>


Ïà¹ØÎĵµ£º

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 ......

AJAX DWR

ʹÓÃԭʼµÄXMLHttpRequest·¢³öÇëÇóʱ,Ö»ÄܶÔServletºÍJSP²Ù×÷
ÔÚJSPÖд´½¨3¸öfunction
1.createXmlHttpRequest----¸ºÔðÅжÏä¯ÀÀÆ÷ÀàÐÍ´´½¨ XMLHttpRequest¶ÔÏó
 var xmlHttpRequest;
 function createXMLHttpRequest(){
   // IE ä¯ÀÀÆ÷
   if(window.ActiveXObject){
&nbs ......

¼òµ¥µÄAJAX»ñÈ¡Êý¾Ý¿â±íÊý¾Ý

A.aspxÒ³Ãæ·ÅÒ»¸ödropdownlist£¬ÔÚA.aspx.csÌí¼Ó£º this.drpSchool.Attributes.Add("onchange", "load(this.options[this.selectedIndex].value)");
ÔÚA.aspxÒ³ÃæÌí¼ÓÈçϽű¾£º
function load(state){
var oHttpReq = new ActiveXObject("MSXML2.XMLHTTP");
var oDoc = new ActiveXObject("MSXML2.DOMDocument");
......

AJAX Cross Domain Same Origin Policy limitation

Õª×Ô£ºhttp://www.ibm.com/developerworks/library/wa-aj-jsonp1/
AJAX Same-Origin Policy(SOP) limitation:
 AJAX prevents cross-domail invokation, there are several ways to by pass this limitation.
1. write a proxy on the server side. The SOP limitation only exists only on the javascript si ......

JS AjaxÈ¡.NET Êý¾ÝÖÐÎÄÎÊÌâ

 ±¾ÈË×î½ü¼òµ¥Ð´ÁËÒ»¸ö¶¯Ì¬È¡Êý¾ÝµÄµÄÒ»¸öAjax·½·¨£¬Ê¹ÓÃJquery×÷Ϊ¿ò¼Ü£¬Ë¼Â·ÈçÏ£ºÊ×ÏÈÀûÓúǫ́°ÑÊý¾Ý´æÈëÒ»¸ö¼òµ¥µÄ¼Çʱ¾ÎļþÖУ¬È»ºóAjax·ÃÎÊÒ»¸öWeb Ò³Ãæ£¬WebÒ³Ãæ»ñÈ¡¼Çʱ¾ÎļþÄÚÈÝ£¬²¢·µ»ØÄÚÈݸøAjax£¬AjaxÊ×Ò³ÏÔʾÊý¾Ý¡£µ«ÊÇÓöµ½ÎÊÌâÁË£¬ÎÊÌâ¾ÍÊÇÖÐÎĵıàÂëÎÊÌâ¡£µ±ºǫ́ȡÊý¾Ý¸øAjax£¬AjaxÏÔʾÊý¾ÝµÄʱºò£¬Ô ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØÍ¼ | ¸ÓICP±¸09004571ºÅ