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

Ajax»ù´¡

1£ºAjax¿ÉÒÔͨ¹ýJavaScriptµÄXMLHttpRequest¶ÔÏóÓë·þÎñÆ÷½øÐÐͨÐÅ£¬Í¨¹ýXMLHttpRequest£¬JavaScript¿ÉÒÔÔÚ²»ÖØÔØÒ³ÃæµÄÇé¿öÏÂÓë·þÎñÆ÷½øÐÐͨÐÅ¡£
 
2£ºXMLHttpRequest ä¯ÀÀÆ÷Ö§³Ö
 
<script type="text/javascript">
function ajaxFunction()
{
var xmlHttp;
try
    {
xmlHttp=new XMLHttpRequest();
//³¢ÊÔFirefoxä¯ÀÀÆ÷
    }
catch (e)
    {
try
    {
xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
//³¢ÊÔIE6.0
    }
catch (e)
    {
try
     {
  xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
//³¢ÊÔIE5.5
     }
catch (e)
     {
  alert("ÄúµÄä¯ÀÀÆ÷²»Ö§³ÖAJAX£¡");
  return false;
     }
}
    }
}
</script>
 
 
3: onreadystatechange ÊôÐÔ Ö¸¶¨·þÎñÆ÷´¦ÀíÍêÇëÇóºóÐèÒªµ÷ÓõĻص÷º¯Êý
 
4£ºreadyState´æ·Å·þÎñÆ÷ÏàÓ¦µÄ״̬£¬4´ú±íÇëÇóÒѾ­Íê³É
xmlHttp.onreadystatechange=function()
  {
  if(xmlHttp.readyState==4)
    {
    }
  }
 
 
5£ºresponseText ÊôÐÔ ´æ·Å·þÎñÆ÷·µ»ØµÄÊý¾Ý
 
6£ºÏò·þÎñÆ÷·¢ËÍÒ»¸öÇëÇó
 
open() ·½·¨ÐèÒªÈý¸ö²ÎÊý¡£µÚÒ»¸ö²ÎÊý¶¨Òå·¢ËÍÇëÇóËùʹÓõķ½·¨£¨GET »¹ÊÇ POST£©¡£µÚ¶þ¸ö²ÎÊý¹æ¶¨·þÎñÆ÷¶Ë½Å±¾µÄ URL¡£µÚÈý¸ö²ÎÊý¹æ¶¨Ó¦µ±¶ÔÇëÇó½øÐÐÒì²½µØ´¦Àí¡£
 
send() ·½·¨¿É½«ÇëÇóËÍÍù·þÎñÆ÷¡£
 
 
 
 
 
 
 


Ïà¹ØÎĵµ£º

jquery ajax ÖÐÎÄÂÒÂë


½áÂÛ£º
jquery 1.3.2 ajax¶Ô±àÂëÎÊÌâ½øÐйý²¿·Ö(¼ûºóÃæ²¹³ä1 )´¦Àí£¬½â¾ö·½°¸ÒÔjspΪÀý×Ó£º 
ajaxÌá½»Êý¾Ý¸øjsp£ºajaxËùÔÚÒ³ÃæÎÞÈκÎÒªÇó£¬jspÒ³ÃæÐè×÷Á½·½Ãæ´¦Àí¡£ 
1.<%@page contentType="application/json" pageEncoding="UTF-8"%>»ò<%@page contentType="application/json" pageEncoding ......

javaÖÐʹÓÃAjax¼¼Êõ

      ajax¼¼ÊõÊÇʹҳÃæÄֲܾ¿Ë¢ÐµÄÒ»ÖÖ¼¼Êõ,È«³ÆÓ¦¸ÃÊÇasynchronous JavaScript and xml´Ó¼¸¸öµ¥´Ê¾ÍÖªµÀËüµÄÇëÇóÏìÓ¦µÄ´¦ÀíÊÇÒì²½µÄ,¶øÇÒʹÓõÄÊÇJavaScriptºÍxml¼¼Êõ.
      ÎÒÃÇÔÚjavaÖÐʹÓÃajax¼¼Êõ×î¼òµ¥µÄÊÇʹÓÃËüµÄÒ»¸ö¿ò¼ÜdwrÖ»Òªµ¼ÈëÕâ¸ö°ü,×öÏàÓ¦µÄÅäÖÃ,¿É ......

Ajaxʵʱ»ñÈ¡ÐÅÏ¢

AjaxµÄIE»º´æÎÊÌ⣬»áÔì³ÉÓÃopenʱÓÃget·½·¨²»ÄÜÖظ´Ìá½»,µ¼Ö»ñÈ¡²»µ½ÊµÊ±µÄÐÅÏ¢¡£½â¾öµÄ°ì·¨ÓÐÒÔϼ¸ÖÖ£º 
1.¿Í»§¶ËÔÚurlºóÌí¼ÓËæ»úÊý. 
new Date().getTime()»òÕßMath.Random() 
»òÕßËÍÇëÇóÇ°¼ÓÉÏ 
XMLHttpRequest.setRequestHeader("If-Modified-Since","0") 
2.»òÕßÓÃpost·½·¨Ìá½»  ......

AjaxÊ×ÂÖʵ¼ù¾­Àú

      ÕâÀïҪ˵µÄûÓдóµÀÀí£¬Ã»ÓÐÔ­Àí£¬Ã»ÓиßÉîµÄ¼¼Êõ£¬Ã»ÓÐYY£¬Ö»ÊÇ×Ô¼ºµÄÒ»´Î¾­Àú£¬ÈռǶøÒÑ¡£ÒÔ·ÀÒÔºóÍü¼ÇÁË£¬ÏÖÔÚдÏÂÀ´¿ÉÒÔ×÷Ϊ²Î¿¼¡£
     
ʱ¼ä£º5ÔÂÑ×ÈȵÄÒ»Ìì
µØµã£º3Â¥
ÈËÎÎÒ£¬µçÄÔ
½á¹û£ºÄ£ÄâÒ»¸öÍøÕ¾µÄ¾Ö²¿Ë¢Ð¹¦ÄÜ
ÉùÃ÷£ºÐÂÊÖ£¬¶ÔAjaxµÚÒ»´ÎÊ¹Ó ......

ajax ·¢ËÍxmlÎļþ£¬java½ÓÊÜxmlÎļþ²¢½âÎö

ºìÉ«×ÖÌåΪÖ÷Òª´úÂë
jspÒ³ÃæÖÐ
<script language="javascript">
function  updateDB(operate){
  var objDom=new ActiveXObject("msxml.DomDocument");
   var objRoot=objDom.createElement("All");
   objDom.appendChild(objRoot);
  
  var k=document.ge ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ