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

ÎҵĵÚÒ»¸öajax ×Ô¶¯Íê³É

Ò»ÖÜǰ£¬leaderÈÃÎÒдһ¸öÀàËÆ°Ù¶ÈµÄ×Ô¶¯Íê³É¹¦ÄÜ£¬ºÇºÇ£¬ÒòΪ¶Ôajax¼¼ÊõÕÆÎյIJ»ºÃ£¬ËùÒÔ¿àÄÕÁ˺ܾÃûÓÐд³öÀ´
¾­¹ýÒ»ÖܵÄѧϰ£¬ÖÕÓÚд³öÁËÒ»¸öajax³ÌÐò£¬ÒÔºóµÄ¹¤×÷¾ÍºÃ×ö¶àÀ²
index.jsp
<html>
<head>
<style >
 #child{
  color: #333;
  width:200px;
  height:200px;
  border: 1px black;
 }
 ul,li{
  margin-left:25px;
  list-style: none;
  line-height: 20px;
 }
</style>
<script type="text/javascript">
 var xmlHttp;
 function autoSelect(word){
  var keywd = word.value;
  var url ="test.do?keywd="+escape(keywd);
  
  if(window.ActiveXObject){
   xmlHttp = new ActiveXObject("Microsoft.XMLHTTP");
  }
  else if(window.XMLHttpRequest){
   xmlHttp = new XMLHttpRequest();
  }
  xmlHttp.open("post",url);
  xmlHttp.onreadystatechange = callback;
  xmlHttp.send(null);s
 }
  function callback(){
   if(xmlHttp.readyState ==4){
    if(xmlHttp.status ==200){
        var temp = xmlHttp.responseText;
   var temparray = new Array();
   if(temp != ''){
    temparray = temp.split("?");
    var str="<ul>";
    for(i=1;i<temparray.length;i++){
     str +="<li>"+temparray[i]+"</li>";
    }
    str +="</ul>";
    document.getElementById("child").innerHTML =unescape(str);
   }
   
    }
   }
  }
</script>
  </head>
 
  <body>
   <form action="test.do" method="post">
    


Ïà¹ØÎĵµ£º

jquery ajaxÈ«½âÎö

jQuery Ajax È«½âÎö
±¾ÎĶÌÖ·£ºhttp://s8.hk/0itq
±¾ÎĵØÖ·: jQuery Ajax È«½âÎö
±¾ÎÄ×÷ÕߣºQLeelulu
×ªÔØÇë±êÃ÷³ö´¦£¡
jQueryȷʵÊÇÒ»¸öͦºÃµÄÇáÁ¿¼¶µÄJS¿ò¼Ü£¬ÄܰïÖúÎÒÃÇ¿ìËٵĿª·¢JSÓ¦Ó㬲¢ÔÚÒ»¶¨³Ì¶ÈÉϸıäÁËÎÒÃÇдJavaScript´úÂëµÄϰ¹ß¡£
·Ï»°ÉÙ˵£¬Ö±½Ó½øÈëÕýÌ⣬ÎÒÃÇÏÈÀ´¿´Ò»Ð©¼òµ¥µÄ·½·¨£¬ÕâЩ·½·¨¶¼ÊǶÔjQu ......

ajax json,xml,Îı¾Êý¾Ý´«µÝʵÀý

µ½×îºóÎҲŷ¢ÏÖ΢Èí¸øµÄajax json ʵÀý¶¼ÊÇÓÐÎÊÌâµÄ£¬ºÜ¶à¶¼ÊDz»ÑÏÃܵģ¬ÌرðÊǶÔÓÚ´óСд·½Ã棬ËûÃǶ¼Ã»ÓÐ×Ðϸ׷¾¿´óСдÎÊÌ⣬µ¼ÖÂÁËÔÚfirefoxʹÓÃÓÐÎÊÌâ¡£ÏÂÃæÊÇʵÀýÄÚÓãºÁ½¸öhtmlÖ®¼äµÄ£º
<head> <title>²âÊÔajax</title> <meta http-equiv=”Content-Type” content=”text/ht ......

Ajax±íµ¥Ìá½»ÂÒÂë

Ajax±íµ¥Ìá½»Êý¾Ý³öÏÖÂÒÂëºÍ½â¾ö°ì·¨
   //Òª´«µÝµÄ²ÎÊý
   var queryString = "firstName=" + firstName + "&lastName=" + lastName
                        &nbs ......

jquery ajaxµÄ $.get()ºÍ$.post()·½·¨


$.get()ºÍ$.post()·½·¨
    $.get(url [,data] [,callback] [,type])
    type£ºstringÀàÐÍ£¬·þÎñÆ÷¶Ë·µ»ØÄÚÈݵĸñʽ£¬°üÀ¨xml£¬html£¬script£¬json£¬textºÍ_default
    »Øµ÷º¯ÊýÖ»ÓÐÁ½¸ö²ÎÊý£ºfunction(data,textstatus){....}
    data:·µ»ØµÄÄÚÈÝ £ ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØÍ¼ | ¸ÓICP±¸09004571ºÅ