ajax·µ»ØÖÐÎÄÊÇÂÒÂ룬ÓÐɶºÃ°ì·¨Âð£¿
ÎÒÊÇÓÃjqueryÀ´×öµÄ£¬ÓÃashxÒ³Ãæ´¦ÀíµÄ¡£
ÏëÁ˺ܶà°ì·¨
µÚÒ»ÖÖ°ì·¨£¬ÔÚashxÉϼÓÁË
C# code:
HttpResponse response = context.Response;
response.Charset = "GB2312";
response.ContentEncoding = System.Text.Encoding.UTF8;
ʧ°ÜÁË¡£
È»ºóÓÖ
C# code:
response.Write(HttpUtility.UrlEncode("ÖÐÎÄÖÐÎÄ"));
response.Write(HttpContext.Current.Server.HtmlDecode("ÖÐÎÄÖÐÎÄ"));
Ò²²»ÐС£
ÔÚjsÀï
JScript code:
$.ajax({
type: "GET",
// contentType: "text/html",
// dataType: "html",
url: "ClientFile/Handler.ashx",
data: "word=" + $("#TextBox1").val() + "&" + new Date().toLocaleTimeString(),
success: function(msg) {
alert(escape(msg));
alert(unescape(msg)); }
});
unescapeºÍescape¶¼²»ÐС£
ÔÚweb.configÀïÌí¼Ó
XML code
Code highlighting produced by Actipro CodeHighlighter (freeware)
http://www.CodeHighlight
Ïà¹ØÎÊ´ð£º
°´Å¥·ÅÔÚUpdatePanel1£¬Ïëͨ¹ýµã»÷µ÷ÓÃDictionaryTvAdd.aspxµ¯³öÒ»¸ö×Ó´°Ìå
ÓÃÏÂÃæµÄÓï¾äÌáʾÎÒȱÉÙ¶ÔÏó
protected void Button1_Click(object sender, EventArgs e)
{
ScriptManager.R ......
<script language="javascript">
var XMLHttpReq;
var cont=true;
//´´½¨XMLHttpRequest¶ÔÏó
function createXMLHttpRequest ......
ÀûÓÃAjax´«µÝÒ»¸ö²ÎÊýµ½getreslt.asp£¬µ«ÊÇ·¢ÏÖgetreslt.aspÓ¦¸ÃÊÇûÄÜ»ñÈ¡µ½£¬¼ì²éÁË·¢ËͲ¿·Ö£¬Ó¦¸ÃÊÇ·¢³öÈ¥Á˵쬵±Ö¸¶¨getreslt.aspµÄ²éѯÌõ¼þ£¬Ò²Äܵõ½responseµÄ½á¹û¡£Âé·³¸÷λ¿´¿´£¬Õâ¸öÊÇ·¢ËͲ¿·ÖÓÐÎÊÌ⻹ÊÇ ......
ÔõÑùѧϰAjaxЧÂʸü¸ß£¿×î½ü¿ªÊ¼½Ó´¥ÕâÏî¼¼Êõ£¬µ«×ÜÊǸоõÄÚÈÝ·±Ëö£¬²»ÈÝÒ×Àí½â£¬Ïà¹ØµÄ½Å±¾¿ª·¢Ò²¾õµÃÄѶȴ󣬴ó¼ÒÓÐûÓйØÓÚѧϰAjaxµÄºÃÊ飬Âé·³¸øÍƼöһЩ£¬Ð»Ð»ÁË~~~
дÓöµ½ÎÊÌâ²é×ÊÁÏ£¬½â¾öÎÊÌ⣬²ÅÓг¤½ø° ......
RT£¡
xmlHttpRequest.send("Ìá½»²ÎÊýÃû=Öµ&Ìá½»²ÎÊýÃû1=Öµ");
var date={"Êý¾Ý1":"Êý¾Ý1Öµ","Êý¾Ý2":"Êý¾Ý2Öµ","Êý¾Ý3":"Êý¾Ý3Öµ" ......