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

·â×°Ò»¸ö¼òµ¥µÄ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 default value
param = typeof(param)=='undefined' ? '' : param;
method = typeof(method)=='undefined' ? 'GET' : method;
response = typeof(response)=='undefined' ? true : response;
//get ajax object
var ajax = null;
try {
   ajax = new ActiveXObject("Msxml2.XMLHTTP");
} catch (e) {
   try {
    ajax = new ActiveXObject("Microsoft.XMLHTTP");
   } catch (E) {
    ajax = null;
   }
}
if (!ajax && typeof XMLHttpRequest!='undefined'){
   ajax = new XMLHttpRequest();
}
if (!ajax){
   alert("Get ajax object failed");
   return false;
}
//send http request
var res = '';
if (method != 'GET'){
   method = 'POST';
}
if (method == 'GET'){
   ajax.open('GET', url + param, true);
   ajax.onreadystatechange = function(){
    if (ajax.readyState==4 && ajax.status==200){
     res = ajax.responseText;
    }
   }
   ajax.send(null);
}
if (method == "POST"){
   ajax.open("POST", url, true);
   ajax.setRequestHeader("Content-Type","application/x-www-form-urlencoded");
   ajax.send(param);
   ajax.onreadystatechange = function() {
    if (ajax.readyState==4 && ajax.status==200) {
     res = ajax.responseText;
    }
   }
}
if (response){
   return res;
}
return null;
}


Ïà¹ØÎĵµ£º

Ajax¿Ø¼þ

NO1.
ÔÚatlas(ajax)ÖÐÇ벻ҪʹÓÃResponse.Write(),
ÇëʹÓÃClientScript.RegisterClientScriptBlockÌæ»»
ʹÓÃÈçÏ£º
ClientScript.RegisterClientScriptBlock(this.GetType(), "", "<script>alert('×Ô¼º¿´×Å°ì!')</script>");
×¢Ò⣺RegisterStartupScript ·½·¨Êǽ« JavaScript ǶÈëµ½ ASP.NET Ò³ÃæµÄµ×²¿£ ......

AJAXµäÐͺ¯Êý

function createXMLHttpRequest() {   // ´´½¨XMLHTTPREQUESTµÄ±ê×¼º¯Êý.¼æÈݸ÷ä¯ÀÀÆ÷.
    if (window.ActiveXObject) {
        xmlHttp = new ActiveXObject("Microsoft.XMLHTTP");
    }
    else if (wind ......

ajax ÖÐÎÄÂÒÂë

½â¾öAjax´«ËÍÖÐÎĻᵼÖÂÂÒÂëµÄÎÊÌâ
//Èç¹û´«ËͲÎÊýÊÇÖ±½Ó¸³ÓèµÄ£¬¾Í»á²úÉúÂÒÂë!
http_request.open("POST",url,true);
http_request.setRequestHeader('Content-Type',
'application/x-www-form-urlencoded');
http_request.send("action="+strName+"&val="+val);   ......

Building a Web 2.0 Portal with asp.net ajax µÚÒ»ÕÂ


[Òë]µÚÒ»Õ ½éÉÜ Web ÃÅ»§ÒÔ¼° Dropthings.com
ÔÚÕâ±¾ÊéÖУ¬ÎÒ½«»á¸øÄúչʾÔõÑù½éÉÜÒ»¸ö Ajax£¬Web 2.0 ʽµÄÃÅ»§¡£Õâ¸öÃÅ»§Ê¹Óà ASP.NET 3.5 , ASP.NET AJAX ºÍ .NET 3.5 , ҲʹÓÃÁË LINQ ºÍ SQL Server 2005.ÔÚ´´½¨Ó¦ÓóÌÐòÖУ¬Äã¿ÉÒÔÁ˽⵽£º
±ØÐëÒª×öµÄÉè¼Æ¾ö¶¨ºÍ Web 2.0 Óû§½çÃæÖпÉÓÃÐÔµÄÎÊÌâ
¼Ü¹¹µÄ¸´ÔÓÐԺͷ ......

AJAX¡¢DOM£¬Ãû´Ê½âÊÍ

£¨ÒÔÏÂÀ´×ÔWIKI£©
      AJAXÈ«³ÆΪ“Asynchronous JavaScript and XML”£¨Òì²½JavaScriptºÍXML£©£¬ÊÇÒ»ÖÖ´´½¨½»»¥Ê½ÍøÒ³Ó¦ÓõÄÍøÒ³¿ª·¢¼¼Êõ¡£¸ù據AjaxÌá³öÕßJesse James Garrett½¨議[1]£¬Ëü£º
ʹÓÃXHTML+CSSÀ´±íʾÐÅÏ¢£»
ʹÓÃJavaScript²Ù×÷DOM£¨Document Object Model£©½øÐ ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ