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

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


$.get()ºÍ$.post()·½·¨
    $.get(url [,data] [,callback] [,type])
    type£ºstringÀàÐÍ£¬·þÎñÆ÷¶Ë·µ»ØÄÚÈݵĸñʽ£¬°üÀ¨xml£¬html£¬script£¬json£¬textºÍ_default
    »Øµ÷º¯ÊýÖ»ÓÐÁ½¸ö²ÎÊý£ºfunction(data,textstatus){....}
    data:·µ»ØµÄÄÚÈÝ £» textstatusÇëÇó״̬£ºsuccess£¬error£¬notmodified£¬timeout 4ÖÖ
    
    Èç¹ûÆÚ´ý·þÎñÆ÷¶Ë·µ»ØµÄÊý¾Ý¸ñʽÊÇXMLÎĵµ£¬ÄÇôÐèÒªÔÚ·þÎñ¶ËÉèÖÃcontent-typeÀàÐÍ£º
        php´úÂ룺header("Content-type:text/xml; charset=utf-8");
    $.postÓë$.get()µÄ½á¹¹ºÍʹÓ÷½Ê½Ïàͬ
    Çø±ð£º
        ·getÇëÇó»á½«²ÎÊý¸úÔÚurlºó½øÐд«µÝ£¬¶øpostÇëÇóÔòÊÇ×÷ΪhttpÏûÏ¢µÄʵÌåÄÚÈÝ·¢Ë͸øweb·þÎñÆ÷¡£
        ·get·½Ê½¶Ô´«ÊäÊý¾ÝÓдóСÏÞÖÆ£¨Í¨³£²»ÄÜ´óÓÚ2KB£©£¬postÀíÂÛÉϲ»ÊÜÏÞÖÆ
        ·get·½Ê½ÇëÇóµÄÊý¾Ý»á±»ä¯ÀÀÆ÷»º´æÆðÀ´£¬ÆäËûÈË¿ÉÒÔ´ÓÀúÊ·¼Ç¼Àï¶ÁÈ¡ÕâЩÊý¾Ý£¬ÈçÕ˺ŵȡ£get·½Ê½»á´øÀ´ÑÏÖصݲȫÎÊÌâ¡£post¿ÉÒÔ±ÜÃâÕâЩÎÊÌâ¡£
        ·getºÍ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 ......

¼òµ¥µÄAJAXÊÖ¹¤·¶Àý

Client¶Ë
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
 <head>
  <script language="javascript">
  var XmlHttp=new ActiveXObject("Microsoft.XMLhttp");
  
  function sendAJAX()
  {
 &nb ......

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

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

ajax¿çÓò·½·¨

     ×òÌì¿´ÁËƪ²»ÊǺÜÑϽ÷µÄ²©ÎÄ¡¶Ò»¸öËãÃüС͵³ÌÐòµÄµ®Éú¡·£¬ÀïÃæдÁËÒ»¸öͨ¹ýAJAX͵ÇÔ±ðÈËÍøÕ¾Ëã·¨µÄ·½·¨¡£Êµ¼ùÁËһϸù±¾²»ÐУ¬AJAXËƺõ²»ÄÜ¿çÓò¡£
     ºóÀ´ÎÒÏëÁËһЩ½â¾ö·½·¨£¬ÖÕÓÚ¿çÓò³É¹¦¡£ÏÖÔÚ¹«²¼Ò»Ï·½·¨¡£
     ÈÎÎñ£ºÔÚ×Ô¼ºÍøÕ¾×ö¸ö±íµ¥£¬Ïò¡ ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ