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


Ïà¹ØÎĵµ£º

struts2+jquery+json+hibernate+ajaxµÄµÇ½demo

ÓÃstruts2+jquery+json+hibernate+ajax×öÁËÒ»¸öµÇ½µÄdemo¡£
1.jspÒ³Ãæ 
<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
<%@taglib prefix="s" uri="/struts-tags"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/x ......

jQuery AjaxÖ®$.get()·½·¨ºÍ$.post()·½·¨

×¢Ò⣺$.get()ºÍ$.post()·½·¨ÊÇjQueryÖеÄÈ«¾Öº¯Êý¡£Ç°Ãæ½²µ½µÄload()·½Ê½ÊǶÔjQuery¶ÔÏó½øÐвÙ×÷µÄ¡£
1¡¢ $.get()·½·¨
¡¡¡¡$.get()·½·¨Ê¹ÓÃGET·½Ê½À´½øÐÐÒì²½ÇëÇó¡£
¡¡¡¡ËüµÄÓï·¨½á¹¹Îª£º
¡¡¡¡$.get( url [, data] [, callback] [, type] )
¡¡¡¡$.get()·½·¨²ÎÊý½âÊÍÈçÏÂ±í£º
²ÎÊýÃû³Æ
Àà¡¡ÐÍ
˵¡¡¡¡Ã÷
url
Strin ......

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

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

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ºÅ