΢ÈíÐû²¼AJAX CDN
ÔÎĵØÖ·¡¿Announcing the Microsoft AJAX CDN
¡¾ÔÎÄ·¢±íÈÕÆÚ¡¿ Tuesday, September 15, 2009 11:46 PM
½ñÌìÔçЩʱºò£¬ASP.NET¿ª·¢ÍŶÓÍƳöÁËÒ»¸öеÄ΢ÈíAjax CDN£¨Content Delivery Network£¬ÄÚÈÝ·Ö·¢ÍøÂ磩·þÎñ£¬¸Ã·þÎñÌṩÁ˶ÔAJAX¿â£¨°üÀ¨jQuery ºÍ ASP.NET AJAX£©µÄ»º´æÖ§³Ö¡£¸Ã·þÎñÊÇÃâ·ÑµÄ£¬²»ÐèÈκÎ×¢²á£¬¿ÉÓÃÓÚÉÌÒµÐÔ»ò·ÇÉÌÒµÐÔÓÃ;¡£
CDN¶¼Ìṩʲô£¿
ÄÚÈÝ·Ö·¢ÍøÂ磨CDNs£©ÊÇÓÉÕ½ÂÔÐÔµØÖ÷ÅÓÚÊÀ½ç¸÷µØ¹Ø¼üInternetÍøÂçµãµÄ“±ßÔµ»º´æ£¨edge cache£©”·þÎñÆ÷×é³ÉµÄ¡£ÕâЩ“±ßÔµ»º´æ£¨edge cache£©”·þÎñÆ÷¿ÉÓÃÓÚ»º´æºÍ·Ö·¢¸÷ÖÖÀàÐ͵ÄÄÚÈÝ£¬°üÀ¨Í¼Æ¬£¬ÊÓƵ£¬CSSºÍJavaScriptÎļþ¡£
ʹÓÃCDN¿ÉÒÔÏÔÖøÌá¸ßÒ»¸öÍøÕ¾µÄÖÕ¶ËÓû§ÐÔÄÜ£¬ÒòΪËüÔÊÐíä¯ÀÀÆ÷¸ü¿ìµØ»ñÈ¡ºÍÏÂÔØÄÚÈÝ¡£ÀýÈ磬¶ÔÒ»¸öͼƬÇëÇó£¬ä¯ÀÀÆ÷²»ÔÙÐèÒª¿çÔ½Internetµ½ÄãµÄweb·þÎñÆ÷ÏÂÔØ£¬Ò»¸öCDN¿ÉÒÔ´ÓÁÚ½üµÄ“±ßÔµ»º´æ£¨edge cache£©”·þÎñÆ÷Ö±½ÓÌṩ·þÎñÂú×ã¸ÃÇëÇ󣬶ø¸Ã±ßÔµ»º´æ·þÎñÆ÷¿ÉÄÜÓëÄãµÄ¿Í»§Ö»ÓÐÒ»¸öÍøÂçµ¥Ìø£¨single network hop£©Ö®Ô¶£¨Ê¹Ö®·µ»Ø·Ç³£Ö®¿ì£¬Ò²Ê¹µÃÄãµÄÍøÒ³×°Ôظü¿ì£©¡£
΢ÈíAJAX CDN¶¼Ìṩʲô£¿
΢ÈíAJAX CDN¼«´óµØ·½±ãÁ˽«jQueryºÍASP.NET AJAX½Å±¾¿â¼Óµ½ÄãµÄÍøÕ¾ÉÏ£¬¶øÇÒ×Ô¶¯µØÓÉÎÒÃÇÔÚÊÀ½ç¸÷µØµÄ³Éǧ¸öµØÀí¶¨Î»£¨geo-located£©µÄ±ßÔµ»º´æ·þÎñÆ÷À´ÌṩÕâЩ½Å±¾¡£
ÀýÈ磬Èç¹ûÄãÏëҪʹÓÃ΢ÈíAJAX CDNµÄjQuery£¬ÄãÖ»ÒªÔÚÍøÒ³ÖмÓÒ»¸öÓÃÁËÏÂÃæURLµÄ±ê×¼µÄ½Å±¾±êʶ£º
<script src="http://ajax.microsoft.com/ajax/jquery/jquery-1.3.2.min.js" type="text/javascript"></script>
ÔÚä¯ÀÀÆ÷ÇëÇó¸Ã½Å±¾Îļþʱ£¬Ëü¾Í»á×Ô¶¯µØÓÉ×î¿¿½üÖÕ¶ËÓû§µÄCDNµÄ“±ßÔµ»º´æ£¨edge cache£©”·þÎñÆ÷Ìṩ¡£ÕâÒâζ×Å£º
ÇëÇó´¦Àí±ÈÖ®·ÃÎÊÄãµÄweb·þÎñÆ÷Òª¿ìºÜ¶à£¨Ê¹µÃÖÕ¶ËÓû§µÄÍøÒ³×°ÔØ¿ìºÜ¶à£©
Äã²»±ØÖ§¸¶¸ÃÎļþµÄ´ø¿í»¨·Ñ£¬ÒòΪ¸ÃÎļþÀ´×ÔÓÉÎÒÃÇÖ§¸¶´ø¿íµÄ·þÎñÆ÷£¨¸øÄãÊ¡ÁËÇ®£©
½Å±¾¿ÉÒÔÇáËɵؿçÕ¾»º´æ£¬ÕâÒâζ×Å£¬Èç¹ûÓû§¸Õ·ÃÎÊÁËÒ»¸öÇëÇó¹ý¸ÃÎļþµÄÍøÕ¾£¬ÄÇô¸ÃÎļþ¾Í²»ÔÙÐèÒªÏÂÔØÁË£¨ÒòΪ¸ÃÎļþÒѾ´æÔÚÓÚä¯ÀÀÆ÷µÄ»º´æÖÐÁË£©
Äã¿ÉÒÔÔÚwww.asp.net/ajax/cdnÕâÀïµÃµ½ÎÒÃÇÒѾÔØÈëÎÒÃǵÄCDN»º´æµÄJavaScript¿â£¨ÒÔ¼°Ïà¹ØµÄURLs£©µÄÍêÕûÁÐ±í¡£
ÔÚ·¢²¼ÐµÄASP.NET AJAX°æ±¾Ê±£¬ÎÒÃÇ»á¸üÐÂCDNÖеĿ⣬»á¼ÌÐø¸üÐÂËüÒÔ°üÀ¨ËæASP.NETºÍVisual Studio·¢²¼µÄËùÓÐ Jav
Ïà¹ØÎĵµ£º
ÉÏ´«Ò³ÃæÖ»ÐèÒªÒ»¸öjsÒýÓúÍjsº¯ÊýµÄµ÷Ó㬼òµ¥·½±ã£¬²»Ó°ÏìÍøÒ³ÔÓв¼¾Ö¡£
ÏÂÔصØÖ·
µ÷ÓÃ˵Ã÷:
1.Ê×ÏÈÒýÓÃjsÎļþ
<script type="text/javascript" src="AienUpload/init.js"></script>
2.½«º¯Êýµ÷ÓÃ(showUpload(boxCtrl,inputCtrl,upPath,maxCount,fn);)°ó¶¨µ½HTMl¿Ø¼þʼþ£¬ÀýÈç
......
Õ⼸Ì칤×÷£¬ÓõÄÊÇAJAX¿ò¼Ü£¬½á¹ûµ¼³öExcel±í¸ñµÄʱºòÎÞ·¨µ¼³ö¡£
½â¾ö°ì·¨£º1¡¢ÔÚ.aspxÒ³ÃæÊ×ÐÐÖÐ<%@ Page Language="C#" AutoEventWireup="true" CodeFile="JinHuoDan.aspx.cs" Inherits="out_store_JinHuoDan" %> Ìí¼ÓEnableEventValidation="false" £»
2¡¢ÔÚUPdatePanelÖÐÌí¼Ó</ContentTemplate>
......
AJAX Á÷ÐÐÖ®ºó£¬×ÜÏëºÃºÃѧϰһÏ¡£µ«ÊÇÖÚ¶àµÄ¿ò¼ÜʵÔÚÄÑÒÔÑ¡Ôñ¡£ËµÃ÷һϠASP.NET AJAX ²¢²»°üÀ¨ÔÚ AJAX ¿ò¼ÜÖ®ÖС£
¸Õ¿ªÊ¼Ñ§ÁË JQuqery£¬ ÖÚ¶àµÄ $get(),...µÈµÈ·ûºÅÔçÒÑ°ÑÎÒ¸ãÔÎÁË¡£ÔÝʱ¾Í·ÅÆúÁË¡£
ºóÀ´Ñ§Ï° ASP.NET AJAX £¬ÔÚ΢ÈíµÄÁ쵼ϣ¬Öð½¥ÓÉ·þÎñÆ÷¶ËתÏò¿Í»§¶Ë±à³Ì¡£ ¼¤ÆðÎÒ¿Í»§¶Ë±à³ÌµÄÐËȤ£¬
²ÅÏëÆðѧ ......
/**
* Ajax²Ù×÷º¯Êý
*
* @param url -- ·þÎñÆ÷¶ËÒ³ÃæµØÖ·
* @param param -- ²ÎÊý£¬ÀàËÆ 'user=123&id=100'
* @param method -- ÇëÇó·þÎñÆ÷¶ËµÄ·½·¨,GetºÍPostÁ½ÖÖ£¬Ä¬ÈÏÊÇGET
* @param response -- ÊÇ·ñ»ñÈ¡·þÎñÆ÷¶Ë·µ»ØµÄ½á¹û£¬Ä¬ÈÏÊÇtrue
*/
function ajax( url, param, method, response ){
//set defaul ......
AjaxµÄÔÀíºÜ¼òµ¥£¬¾ÍÊÇÔÚ¿Í»§¶Ë´´½¨Ò»¸öXMLHttpRequest¶ÔÏó£¨ÓÃÀ´Óë·þÎñÆ÷½øÐÐÒ첽ͨÐÅ£¬Õâ¾ÍÊÇAjaxµÄºËÐÄ£¬ÆäʵÎÒÃÇÔç¾ÍÔÚÓÃÒ첽ͨÐÅÁË£¬Ö»ÊÇû°ÑÕâÏî¼¼ÊõÓÃÔÚÍøÒ³Éè¼ÆÖжøÒÑ£©£¬Îª¸Ã¶ÔÏóµÄonreadystatechange ÊôÐÔÌí¼ÓÒ»¸öʼþ£¬µ±¶ÔÏóµÄreadyState¸Ä±äµÄʱºò¾Í»áÒý·¢Ö¸¶¨µÄʼþ¡£µ½´Ë¾Í¿ÉÒԾͷ¢ËÍÇëÇó¶ÁÈ¡·þÎñÆ÷¶ ......