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

¹ØÓÚ³¹µ×½â¾öAjaxÒì²½µ÷ÓÃʱ³öÏÖÖÐÎÄÂÒÂëµÄÎÊÌâ

½ñÌì°ïͬʽâ¾öÁËjsÒì²½µ÷ÓÃʱ³öÏÖÁËÖÐÎÄÂÒÂëµÄÎÊÌ⣬¾ßÌå½â¾ö°ì·¨ÈçÏ£º
1£©Ê×ÏÈÈ·ÈÏjsÊÇ·ñûÓжԺǫ́´«Êä¹ýÀ´µÄÖÐÎĽøÐнâÂë¡£
   °´ÕÕÍøÂçÉÏдµÄ·½·¨Í¨¹ýjs¶ÔresponseµÄ¶ÁÈ¡³öÀ´Êý¾Ý½øÐжà´Î²âÊÔ£¬·¢ÏÖÈÔÈ»²»Äܽâ¾ö£¬Ï¸Ïë²»Ò»¶¨ÊÇ´Ë´¦ÎÊÌâ¡£¸Ä»»ÆäËû°ì·¨½â¾ö¡£
2£©Èç¹û½âÂë½â¾ö²»ÁË£¬ÔÙ¿´ÊÇ·ñÊÇÒòΪÍøÂç´«Êä¹ýÀ´µÄʱºò±àÂë¡£
ÔÚºǫ́Íùǰ̨jsÖÐÒ³Ãæ»ØдÊý¾Ý֮ǰ£¬ÏÈÉèÖÃresponseµÄ´«Êä±àÂëΪUTF-8£¨ÒòΪxmlHttp.responseText¶ÁÈ¡ºǫ́µÄ´«Êä×Ö·ûµÄĬÈϱàÂë¾ÍÊÇUTF-8£©£¬
   ºǫ́java´úÂëÈçÏ£º
    response.setCharacterEncoding("UTF-8"); 
    PrintWriter out=response.getWriter();  
    String s = "123ÄãºÃ";
    out.print(s); //Íùǰ̨µÄjsÖлØдÏìÓ¦ÐÅÏ¢
 
    ǰ̨µÄjs´úÂëÈçÏ£º
    var xmlHttp = new ActiveXObject("Msxml2.XMLHTTP");
    var url = "/test/RelateClitInfoQueryService?clitno=" + clitno;   
    xmlHttp.open("post",url,false);
    xmlHttp.send();
      
    //»ñÈ¡·µ»ØÖµ
    if(xmlHttp.responseText != null){
     var clitinfo_tmp = xmlHttp.responseText;
    
     //ÔÚjava´úÂëÖÐÌí¼Óresponse.setCharacterEncoding("UTF-8"); ºóalert³öÀ´µÄÖÐÎľÍÊÇÕý³£µÄÁË£¬Èç¹û²»¼Ó¾ÍÊÇÂÒÂ루¼´£¿£©
     alert("clitinfo_tmp==" + clitinfo_tmp); 
    }
¾Í´ËÎÊÌâ½â¾ö¡£Ï£Íû´ËÎÊÌâµÄ½â¾ö¶ÔÆäËûÓöµ½ÂÒÂëµÄÅóÓÑÓÐËù°ïÖú¡£


Ïà¹ØÎĵµ£º

AJAXʹÓÃjson½âÎöÓëʹÓÃxml½âÎöµÄ±È½Ï

¹¤¾ß:myeclipse 6.5
jsonÖÐÎĹٷ½£ºhttp://www.json.org/json-zh.html
н¨ÏîÄ¿webs£¬ÔÚWebRootÏÂн¨Ä¿Â¼json
xmlµÄ½âÎö·½Ê½:
------------------------------------------------------------------
1.н¨NewFile.xml
<?xml version="1.0" encoding="UTF-8"?>
<userinfo>
  ......

Ö´ÐÐAJAX·µ»ØHTMLƬ¶ÎÖеÄJavaScript½Å±¾

Èç¹ûAJAX¼ÓÔصÄÊý¾ÝÊÇÒ»¸öHTMLƬ¶Î£¬¶øÇÒÕâ¸öHTMLƬ¶Î»¹°üº¬½Å±¾<script>¿é£¬ÄÇôÔÚÄã°ÑÕâÊý¾ÝxmlHttp.responseTextÓÃinnerHTML·½·¨²åÈëµ½µ±Ç°ÎĵµÒ»¸öÔªËØÖУ¬Äã»á·¢ÏÖAJAX¼ÓÔØ»ØÀ´µÄ½Å±¾¸ù±¾Ã»ÓÐÖ´ÐС£ÕâÊÇAJAX¿ª·¢Öкܳ£¼ûµÄÎÊÌ⣬Èç¹ûÄã²»ÊÇÒ»Ö±ÔÚÓÃJavaScript¿ò¼Ü×ö¿ª·¢£¬ÏàÐÅÄãÔç¾Í·¢ÏÖÕâ¸öÎÊÌâÁË¡£±¾ÎÄ·ÖÎöÁËÁ ......

AJAXÍøҳץȡ¹¤¾ß Krabber 0.2.9Õýʽ·¢²¼

¾­¹ýÕûÀíºÍµ÷ÊÔ£¬Krabber 0.2.9°æ±¾Õýʽ·¢²¼ÁË¡£
Õâ¸ö°æ±¾µÄÌصãÊDz»½ö½ö¿ÉÒÔÖ´ÐÐAJAXÍøÒ³²¢·µ»ØÖ´ÐкóµÄ½á¹û£¬»¹¿ÉÒÔÓɳéÈ¡Óû§Ìṩ½Å±¾½øÐÐÖ´ÐУ¬²¢·µ»ØÖ´ÐÐÓû§µÄ¶¯×÷½Å±¾ºóµÄ½á¹û¡£ÕâÒ»ÌØÐÔ¿ÉÒԺܺõĽâ¾öÐèÒª½øÐÐAJAX·­Ò³¡¢ÑÓʱ¼ÓÔصȵÈÎÊÌâ¡£
ÁíÍâÓÉÓÚ¾«Á¦ÓÐÏÞ£¬°æ±¾Ã»Óо­¹ýÑϸñµÄ²âÊÔ£¬Òò´ËÓÐÎÊÌâÇëÔÚÕâÀïÁôÑÔ£¬Ð ......

ajaxµÄ³õ¼¶Ó¦ÓÃ

תÔØÓÚhttp://xzio.javaeye.com/blog/91713
×î³õ¿´µ½ajax¸Ð¾õºÃ¾ªÏ²°¡£¬²»ÓÃË¢ÐÂÈ«²¿Ò³Ã棬¾Í¿ÉÒÔ¸ü¸Ä¾Ö²¿Ò³ÃæÊý¾Ý¡£ÕæµÄºÜ·½·¨
µ«ÊÇÒÔΪ»áºÜÄÑ£¬µ«Êµ¼Ê×öÁ˲ÅÖªµÀ£¬AJAXºÜ¼òµ¥¡£ÖÁÉÙÈëÃźܼòµ¥ Èç¹ûÄã»áajaxÄǾͲ»Òª¿´ÁË¡£¸ü²»ÒªÂîÎÒ¡£±ÈÎÒÅ£µÄÈËÌ«¶àÁË
»¥ÏཻÁ÷£¬Ñ§Ï°¡£MSN:whw_dream(AT)hotmail.com
Ê×ÏÈÊÇjspÒ³ÃæºÍ ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ