AJAXÖÐÎÄÂÒÂëµÄÁ½ÀàÎÊÌâ½â¾ö·½·¨
1£©·¢ËÍ·¾¶ÖеIJÎÊýÓÐÖÐÎÄ£¬ÔÚ·þÎñÆ÷¶Ë½ÓÊÕ²ÎÊýÖµÊÇÂÒÂë
½â¾ö·½·¨£º
PHP:
·þÎñÆ÷¶Ë£ºiconv("UTF-8","gb2312",$_POST[±äÁ¿Ãû]);
JSP:
¿Í»§¶Ë:
ÀûÓÃjavascriptµÄÌṩµÄescape()»òencodeURI()·½·¨, Àý
var url="a.jsp?name=СÀî"£»
url=encodeURI(url);
url=encodeURI(url); //Á½´Î£¬ºÜ¹Ø¼ü[¾ßÌåΪʲô£¬ÎÒÒ²²»Çå³þ]
/********************************************/
Ò²ÓÐÈËд³Évar url="a.jsp?name=escape("СÀî")"£»
¹¦ÄܺÍencodeURI·½·¨ÀàËÆ¡£
/********************************************/
xmlHTTP.setrequestheader("contentType","text/html;charset=uft-8")//Ö¸¶¨·¢ËÍÊý¾ÝµÄ±àÂë¸ñʽ
·þÎñÆ÷¶Ë£ºjava.net.URLDecoder.decode(request.getParameter(±äÁ¿Ãû), "UTF-8");
2£©·µ»ØÀ´µÄresponseText»òresponseXMLµÄÖµÖк¬ÓÐÖÐÎÄÊÇÂÒÂë
ÔÒò£ºAJAXÔÚ½ÓÊÕresponseText»òresponseXMLµÄÖµµÄʱºòÊÇ°´ÕÕUTF-8µÄ¸ñʽÀ´½âÂëµÄ£¬Èç¹û·þÎñÆ÷¶Î·¢Ë͵ÄÊý¾Ý²»ÊÇUTF-8µÄ¸ñʽ£¬ÄÇô½ÓÊÕresponseText»òresponseXMLµÄÖµÓпÉÄÜΪÂÒÂë¡£
½â¾ö·½·¨£ºÔÚ·þÎñÆ÷¶ËÖ¸Ã÷ËͳöÊý¾ÝµÄ±àÂëÁ÷
PHP:header('Content-Type:text/html;charset=GB2312');
ASP:Response.Charset("GB2312")
JSP:response.setHeader("Charset","GB2312");
Èç¹ûÉÏÊö·½·¨ÈÔÈ»½â¾ö²»ÁËÂÒÂëÎÊÌâ,ÄÇÄã³¢ÊÔһϰÑÎļþÓÃUTF-8±àÂë¸ñʽ±£´æ.
×ÜÖ®:Ç°ºǫ́Êý¾Ý½»»¥¶¼²ÉÓÃutf-8±àÂë¾ÍÐÐÁË.
Ïà¹ØÎĵµ£º
//³õʼ»¯¶ÔÏó²¢·¢³öXMLHttpRequestÇëÇó
xmlHttp= false;
if (window.XMLHttpRequest)
{ //MozillaµÈÆäËûä¯ÀÀÆ÷
xmlHttp= new XMLHttpRequest();
if (xmlHttp.overrideMimeType)
{
& ......
<script language="javascript" type="text/javascript">
¡¡¡¡function doubleSalary()
¡¡¡¡{
¡¡¡¡var employee = new Object();
¡¡¡¡employee.FirstName = "X";
¡¡¡¡employee.LastName = "PP";
¡¡¡¡employee.Salary = 1000;
......
ÒÔºó˵Ã÷¾ÍдÔÚÕâÀïÁË,¸Ã¿Ø¼þÖ»µ±ÊÇÁ·ÊÖ ÎÒ°Ñ˵Ã÷Ò»Æð´ò°üÁË ²»¹ý»¹ÊÇÔÚÕâÀï¶øÔÚÌù³öÀ´ ÎÒÓпյÄʱºò¾Í»áÀ©Õ¹ÆäËû¹¦ÄÜÁË
¸ßÊ־ͿÉÒÔÆ®¹ýÁË... ÿ´Î¸üÐÂÎÒ¶¼»á°ÑÔÀ´µÄ¿Ø¼þÒ»Æð´ò°ü Îļþ¿ÉÄÜÔ½À´Ô½´ó,ºÇºÇ »¶Ó½»Á÷
Ax¿Ø¼þÓÃÓÚajaxÇëÇó
Ö§³Öä¯ÀÀÆ÷ »ðºü IE µÈ...
¿Ø¼þ²ÎÊý
_Async ÊÇ·ñͬ²½ trueΪÒì²½ fals ......
web2.0ºá¿Õ³öÊÀ£¬ajaxÊ×µ±Æä³å£¬½ñÌì×öwebµÄÈç¹ûÔÙ²»Ñ§µãajaxµÄ»°£¬¾ÍÏÔµÄÂäÎéÁË£¬¶øѧajaxµÄÓõĻ·¾³Èç¹ûÊÇasp.net£¬ÄÇajax.netÄã¾Í²»µÃ²»Ñ§ÁË¡£Ê×ÏȾÍÊÇ»·¾³µÄÅäÖã¬ÈçÏÂ
vs2005+sql2005+Winxp sp2+ie6.0+Office2003»·¾³ÉèÖÃÈçÏ£º
ÏÂÔØÍê ASPAJAXExtSetup.msi °²×°¸üкóÔÚÄãµÄϵͳÅÌϵģ¨ÒÔCÅÌΪÀý£© ³öÏÖÕâ¸ö Îļ ......