Ajax±àÂëºÍAjaxÂÒÂë½â¾ö
AJAXÂÒÂë½â¾ö
ÓùýAJAXµÄÅóÓѿ϶¨ÖªµÀjavascriptÊÇʹÓÃUTF-8¹ú¼Ê±àÂ룬¼´Ã¿¸öºº×ÖÓÃ4¸ö×Ö½ÚÀ´´æ´¢£¬µ«ÊÇÕâ¾ÍÔì³ÉÁËÓÃAJAXÀ´sendÊý¾ÝµÄʱºò³öÏÖÂÒÂë¡£
AjaxÂÒÂë²úÉúÖ÷ÒªÓÐ2¸öÔÒò
1. xtmlhttp ·µ»ØµÄÊý¾ÝĬÈϵÄ×Ö·û±àÂëÊÇutf-8£¬Èç¹ûÇ°Ì¨Ò³ÃæÊÇgb2312»òÕ߯äËü±àÂëÊý¾Ý¾Í»á²úÉúÂÒÂë
2. post·½·¨Ìá½»Êý¾ÝĬÈϵÄ×Ö·û±àÂëÊÇutf-8£¬Èç¹ûºǫ́ÊÇgb2312»òÆäËû±àÂëÊý¾Ý¾Í»á²úÉúÂÒÂë
Ò»¡¢Ê¹ÓÃencodeURIComponent¼ÓÉÏÐÞ¸Ä Content-Type Ϊ application/x-www-form-urlencoded" À´°ÑÊý¾Ýͳһ±àÂë³É url ¸ñʽ£¬µ«ÊÇÕâÑù×öÓÐÒ»¸ö±×¶Ë£¬¾ÍÊÇÌ«´óµÄÊý¾ÝÍùÍù»á³ö´í¡£
¶þ¡¢ÊÇͨ¹ývbscript µÄдµÄº¯Êý°ÑÊý¾Ýת³Égb2312¸ñʽµÄ£¬ÎÒ¸öÈ˾õµÃÕâÖÖ·½·¨±È½ÏºÃ¡£ÓÐÐËȤµÄÅóÓÑ¿ÉÒÔµ½ÍøÉÏÈ¥²éһϡ£
Èý¡¢¿Í»§¶Ë¡¢·þÎñÆ÷¶ËÈ«²¿²ÉÓÃUtf-8±àÂ룬ÇÒurl·¢ËÍÖÐÎÄ×Ö²ÉÓÃescape±àÂë,unescape½âÂë¡£¶øÇÒЧÂʸß,¶øÇÒ·ûºÏĿǰµÄÐÎʽ,utf-8±àÂë±¾Éí¾ÍÊÇÒ»ÖֱȽÏÓÅÐãµÄ±àÂë¡£
½ñÌìÍ»·¢ÆæÏ룬AJAXµ÷ÓõÄʱºò»á²»»á·¢ËÍcookie ÄØ£¿ÂíÉÏдÁËÒ»¸ö³ÌÐò²âÊÔһϣ¬¹ûÈ»ÄÜ£¬ÕâÑù¾Í¿ÉÒÔÔÚµ÷ÓÃajax֮ǰ£¬ÏȰÑÊý¾Ýͨ¹ýjavascriptдµ½cookieÀȻºóÔÙsend¾Í¿ÉÒÔ½«cookieÀïµÄÊý¾Ý·¢ËͳöÈ¥ÁË£¬Ì«Ë¬ÁË£¡£¡
¿Í»§¶Ë´úÂë ajax.htm
<title>AJAXʹÓÃcookie´«ÖµÀý×Ó</title>
<script>
var oDiv
var xh
function getXML()
{
setcookie($('name').value,$('val').value);
oDiv = document.all.m
oDiv.innerHTML = "ÕýÔÚ×°ÔØ£¬ÇëÉԺ."
oDiv.style.display= ""
xh = new ActiveXObject("Microsoft.XMLHTTP")
xh.onreadystatechange = getReady
xh.open("POST","a.php",false)
xh.send();
}
function getReady()
{
if(xh.readyState==4)
{
if(xh.status==200)
{
&n
Ïà¹ØÎĵµ£º
×î½üÍøÉÏÌáµÄºÜ¶àµÄÒ»¸öиÅÄî¾ÍÊÇ AJAX ÁË, ÄÇô, AJAX ÊÇÊ²Ã´ÄØ? ÒÔÏÂÄÚÈÝÒýÓÃÍøÉÏ×ÊÁÏ:
AJAXÈ«³ÆÎª“Asynchronous JavaScript and XML”£¨Òì²½JavaScriptºÍXML£©£¬ÊÇÖ¸Ò»ÖÖ´´½¨½»»¥Ê½ÍøÒ³Ó¦ÓõÄÍøÒ³¿ª·¢¼¼Êõ¡£ËüÓлúµØ°üº¬ÁËÒÔϼ¸ÖÖ¼¼Êõ£º
Ajax£¨Asynchronous JavaScript + XML£©µÄ¶¨Òå
»ùÓÚ web±ê×¼£¨sta ......
Js´úÂë
var url=Service.aspx?Value=' + escape(va);
obj=CreateAJAX();
if(obj)
& ......
ÓкܾÃÒ»¶Îʱ¼äÎÒµÄBLOGÉÏûÓгöÏÖAJAXÏà¹ØÑ¶Ï¢ÁË£¬Ö÷Òªµ±È»ÊÇÒòΪ¾ø´ó²¿·ÖµÄÖØÐͼ·Åµ½ÁËSilverlightÉíÉÏ(¿ÉÔ¤ÆÚµÄδÀ´Ó¦¸ÃÒ²»áÊÇÈç´Ë)¡£
µ«ÓÉÓÚ¹¤×÷ÉϵÄÐèÒª£¬×î½ü»¹ÊÇ»ØÍ·¿´ÁËһϼ´½«ÍƳöµÄASP.NET Ajax Library...£¬Ë³±ãÕÒÁËÒ»ÏÂÍøÂçÉϵÄѶϢ£¬¿´Õâ¸öÌ¬ÊÆÎÒ²ÂÏëÓ¦¸Ã²»ÉÙASP.NET¿ª·¢ÈËÔ±ºöÂÔµôÁËÕâ¸öÆäʵÒѾbet ......
AJAX Ö¸Òì²½ JavaScript ¼° XML£¨Asynchronous JavaScript And XML£©¡£
ÄúÓ¦µ±¾ß±¸µÄ»ù´¡ÖªÊ¶
ÔÚ¼ÌÐøÑ§Ï°Ö®Ç°£¬ÄúÐèÒª¶ÔÏÂÃæµÄ֪ʶÓлù±¾µÄÁ˽⣺
HTML / XHTML
JavaScript
AJAX = Òì²½ JavaScript ¼° XML£¨Asynchronous JavaScript and XML£©
AJAX ²»ÊÇÒ»ÖÖеıà³ÌÓïÑÔ£¬¶øÊÇÒ»ÖÖÓÃÓÚ´´½¨¸üºÃ¸ü¿ìÒÔ¼°½»»¥ÐÔ¸üÇ¿µ ......
ºÜ¶àÅóÓÑÎÊÎÒÈçºÎʵÏÖÎÞË¢ÐÂÉÏ´«Í¼Æ¬,ÕâÀïСºÚ¸ø´ó¼ÒÕÒÁËһƪ¹ØÓÚÎÞË¢ÐÂʵÏÖͼƬÉÏ´«µÄÎÄÕÂ,Ï£Íû¶Ô´ó¼ÒÓаïÖú.
±¾ÎĿͷþ¶ËʹÓõÄÊÇajax.netÒì²½ÉÏ´«Îļþ
1.ÔÚ
protected void Page_Load(object sender, EventArgs e)
{
Ajax.Utilit ......