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

Ajax¿çÓò·ÃÎÊ·½·¨´óÈ«

Case I. Web´úÀíµÄ·½Ê½ (on Server A)
¼´Óû§·ÃÎÊAÍøվʱËù²úÉúµÄ¶ÔBÍøÕ¾µÄ¿çÓò·ÃÎÊÇëÇó¾ùÌá½»µ½AÍøÕ¾µÄÖ¸¶¨Ò³Ã棬ÓɸÃÒ³Ãæ´úÌæÓû§Ò³ÃæÍê³É½»»¥£¬´Ó¶ø·µ»ØºÏÊʵĽá¹û¡£´Ë·½°¸¿ÉÒÔ½â¾öÏֽ׶ÎËùÄܹ»Ïëµ½µÄ¶àÊý¿çÓò·ÃÎÊÎÊÌ⣬µ«ÒªÇóAÍøÕ¾ÌṩWeb´úÀíµÄÖ§³Ö£¬Òò´ËAÍøÕ¾ÓëBÍøÕ¾Ö®¼ä±ØÐëÊǽôÃÜЭ×÷µÄ£¬ÇÒÿ´Î½»»¥¹ý³Ì£¬AÍøÕ¾µÄ·þÎñÆ÷¸ºµ£Ôö¼Ó£¬ÇÒÎÞ·¨´úÓû§±£´æsession״̬¡£
Case II. on-Demand·½Ê½ (on Server A)
MYMSNµÄÃÅ»§¾ÍÓõÄÕâÖÖ·½Ê½£¬²»¹ý MYMSNÖв»Éæ¼°¿çÓò·ÃÎÊÎÊÌâ¡£ÔÚÒ³ÃæÄÚ¶¯Ì¬Éú³ÉеÄ<mce:script type="text/javascript"><!--
£¬½«ÆäsrcÊôÐÔÖ¸Ïò±ðµÄÍøÕ¾µÄÍøÖ·£¬Õâ¸öÍøÖ··µ»ØµÄÄÚÈݱØÐëÊǺϷ¨µÄJavascript½Å±¾£¬³£ÓõÄÊÇJSONÏûÏ¢¡£´Ë·½°¸´æÔÚµÄȱÏÝÊÇ£¬ scriptµÄsrcÊôÐÔÍê³É¸Ãµ÷ÓÃʱ²ÉÈ¡µÄ·½Ê½Ê±get·½Ê½£¬Èç¹ûÇëÇóʱ´«µÝµÄ×Ö·û´®¹ý´óʱ£¬¿ÉÄÜ»áÎÞ·¨Õý³£ÔËÐС£²»¹ý´Ë·½°¸·Ç³£ÊʺϾۺÏÀàÃÅ»§Ê¹Óá£
<html>
<head>
<script language="javascript" type="text/javascript">
function loadContent()
{
var s=document.createElement('SCRIPT');
s.src='http://www.anotherdomain.com/TestCrossJS.aspx?f=setDivContent';
document.body.appendChild(s);
}
function setDivContent(v)
{
var dv = document.getElementById("dv");
dv.innerHTML = v;
}
// --></mce:script>
</head>
<body>
<div id="dv"></div>
<input type="button" value="Click Me" onclick="loadContent()">
</body>
</html>
ÆäÖеÄwww.anotherdomain.com/TestCrossJS.aspxÊÇÕâÑùµÄ£¬
<mce:script language="C#" runat="server"><!--
void Page_Load(object sender, EventArgs e)
{
string f = Request.QueryString["f"];
Response.Clear();
Response.ContentType = "application/x-javascript";
Response.Write(String.Format(@"
{0}('{1}');",
f,
DateTime.Now));
Response.End();
}
// --></mce:script>
µã»÷“Click Me”°´Å¥£¬Éú³ÉÒ»¸öеÄscript tag£¬ÏÂÔضÔÓ¦µÄ Javascript ½Å±¾£¬½áÊøʱ»Øµ÷ÆäÖеÄsetDivContent()£¬´Ó¶ø¸üÐÂÍøÒ³ÉÏÒ»¸ödivµÄÄÚÈÝ¡£
Case III. iframe·½Ê½ (on Server A)
²é¿´¹ýÐÑÀ´ÔÚjavaeyeÉϵÄһƪ¹ØÓÚ¿çÓò·ÃÎʵ


Ïà¹ØÎĵµ£º

ajax³õ²½´î½¨¼°Ê¾Àý´úÂë

AJAX(Asynchronous JavaScript and XML):»ùÓÚXMLµÄÒì²½JavaScript£¬¼ò³ÆAJAX,ÊǶàÖÖ¼¼ÊõµÄ×ÛºÏ.
   Ò»ÖÖ¿Í»§¶Ë¼¼Êõ ,Ϊ»¥ÁªÍøÓû§Ìṩ¸ü¼ÓÓÑÉƵĽ»»¥½çÃæ,¸ü¼ÓÁ÷³©µÄÓû§ÌåÑé.Ò²¾ÍÊÇËùνµÄÅÖ¿Í»§¶Ë,ʹÍøÒ³µÄЧ¹ûÄܹ»Ïñ°²×°ÔÚ¼ÆËã»úÉϵÄÓ¦ÓÃÈí¼þ»òϵͳһÑùÓѺûªÀö.
ËüÓÉÈçÏÂËÄÖÖ¼¼Êõ×é³É:CSS + DOM + XMLHttpRe ......

ASP.NET Óë AJAXµÄʵÏÖ·½Ê½

µ½Èí¼þ¹«Ë¾Ñ§IT¼¼Êõhttp://www.tsp2c.cn/
Ajax Ó¦¸Ã²»ÊÇÒ»Ïî¼¼Êõ£¬ÊÇÒ»ÖÖ˼Ïë¶øÒÑ£¬¸ú ASP.NET ÒÔ¼°ÆäËü Web ¿ª·¢ÓïÑÔûÓÐʲô̫´ó¹Øϵ£¬ÕâÀïÖ»ÊÇ̸̸ ASP.NET ÖÐĿǰʹÓÃµÄ Ajax ¼¼ÊõÒÔ¼°ÆäËüһЩʵÏÖ Ajax µÄÓÅÐã¿ò¼Ü¡£
¡¡¡¡Ajax ÒѾ­ºÜÁ÷ÐÐÒ»Õó×ÓÁË£¬ÏÖÔÚ̸ Ajax ¾õµÃÓеãÀÏÍÁ¡£Ä¿Ç°ËùνµÄ Web2.0 ÍøÕ¾£¬»ù±¾ÉÏûÓв» ......

FlexÓëAJAX

        FlexÓÐרÓеıàÒë½âÎöÆ÷£¬ÓÉÓÚAJAXÉæ¼°µ½JAVASCRIPT¼¼Êõ£¬ËùÒÔ»¹ÊÇÃæ¶Ô¿çä¯ÀÀÆ÷µÄ·³ÈÅ¡£ajaxÔÚÒ³ÃæÉÏ´¦ÀíһЩ¼òµ¥Âß¼­Ê±£¬ÐèÒªÓÃJAVASCRIPTÀ´´¦Àí£¬Äã°²ÐĵÄÔÚÄãµÄä¯ÀÀÆ÷ÉϱàÒë½âÎöͨ¹ýÁË£¬ÄãÒÔΪ´ó¹¦¸ã³ÉÁË£¬¿ÉÊÇÊâ²»Öª£¬½Óõà¶øÀ´µÄÊÇ¿Í»§µÄͶËߣ¬ÒòΪÄãÔ­ÒÔΪ³É¹¦µÄÒ³ÃæÔÚËûà ......

XMLHttpRequest½øÐÐajaxͨѶʱÖÐÎÄÂÒÂëÎÊÌâ½â¾ö

 Ê¹ÓÃjsµ÷ÓÃXMLHttpRequest½øÐÐajaxͨѶʱ£¬Èç¹û·þÎñÆ÷¶ËÒª´«µÝµÄÊý¾ÝÖÐÓÐÖÐÎÄʱ£¬ÎÒÃǵĽâ¾ö°ì·¨¡£
1¡¢Ò³Ã棺
     Ò»°ãÔÚÒ³ÃæÎÒÃÇΪÁË·½±ã£¬×îºÃʹÓÃUTF-8±àÂë¡£
2¡¢·þÎñÆ÷¶Ë£º
     ÎÒÃÇÔÚ·þÎñÆ÷¶ËµÄ´úÂëÀïÃæ¶Ôresponse¶ÔÏóµÄÉèÖÃÈçÏ£º
//ÉèÖÃresponseµÄ±àÂë
......

ÈçºÎʹÓÃajax¿ª·¢webÓ¦ÓóÌÐò£¨1£©

1.  http://hi.baidu.com/lshun/blog/item/2378b4c36fdef455b219a85b.html
CODE:
<?xml version="1.0" encoding="UTF-8"?>
<data>
   <pets>
     <è />
     <¹· />
     < ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ