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

ajaxʵÏÖWEBÒ³ÃæÉ϶àÈÎÎñͬʱ×÷Òµ

½ñÌìÐèҪдһ¸ö¹¦ÄÜ£¬¶ÔÓÚÊý¾Ý¿âÖеÄÊý¾Ý£¬ÔÚÓû§Í¨¹ýWEBÏÔʾ³öÀ´µÄʱºò£¬×Ô¶¯Æô¶¯·þÎñÆ÷¶Ë½Å±¾¶Ôÿ¸öÊý¾ÝµÄÓÐЧÐÔ½øÐмì²â£¬²¢½«½á¹û³ÊÏÖ¸øÓû§¡£
ÎÒ¿¼ÂǵľÍÊÇ£¬³ÊÏÖÿÌõÊý¾ÝµÄʱºò£¬Æô¶¯Ò»¸öajaxͨÐŽø³Ì£¬½«½á¹û·´À¡»ØÀ´¾ÍOKÁË¡£
ϸ½Ú·½ÃæÐèÒª¿¼ÂǵÄÊÇ£¬Ã¿¸ö½ø³ÌÍê³ÉÈÎÎñºóÔڻص÷µÄʱºòÈçºÎÖªµÀËüµÄ“ËÞÖ÷”Êý¾ÝÊÇÄÄÒ»¸ö£¨ÄÄÌõÊý¾Ý·¢ÆðµÄÈÎÎñ£©¡£
»¹ÓÐÓÉÓÚXMLHttpRequest¶ÔÓÚÿ¸öÈÎÎñ¶¼ÊÇ˽Óеģ¬ÎÒÃÇÐèÒª¶àÈÎÎñ²¢·¢£¬ËùÒÔÕâÀïÎÒʹÓÃÒ»¸öÀà·â×°Õû¸öÈÎÎñ¡£Ã¿´ÎÆô¶¯Ò»¸öÀà¶ÔÏ󣬽«Æä×÷ΪÀàµÄ˽ÓгÉÔ±¡£
ÏÂÃæ¿´¿´ÎÒÃǵĿͻ§¶Ë½Å±¾Ä£ÐÍ
//¼ì²âURLµÄajax½ø³ÌÀà
function TaskAjaxProcess()
{
//Àà³ÉÔ±XMLHttpRequest
var http_request_check_url = false;

//Æô¶¯ÈÎÎñ
this.start_task = function( $obj )
{
var checkurl = $obj.alt;
////////////´´½¨http request//////////////////
http_request_check_url=false;

//¿ªÊ¼³õʼ»¯XMLHttpRequest¶ÔÏó
if(window.XMLHttpRequest)//Mozillaä¯ÀÀÆ÷
{
http_request_check_url=new XMLHttpRequest();
if(http_request_check_url.overrideMimeType)
{//ÉèÖÃMIMEÀà±ð
http_request_check_url.overrideMimeType("text/xml");
}
}
else if(window.ActiveXObject)//IEä¯ÀÀÆ÷
{
try
{
http_request_check_url=new ActiveXObject("Msxml2.XMLHttp");
}
catch(e)
{
try
{
http_request_check_url=new ActiveXobject("Microsoft.XMLHttp");
}
catch(e){}
}
}
//Òì³££¬´´½¨¶ÔÏóʵÀýʧ°Ü
if(!http_request_check_url)
{
document.getElementById("searchresult").innerHTML="<font color=red>Fault error:´´½¨XMLHttp¶ÔÏóʧ°Ü£¡</font>";
return false;
}

//ÔÚURLÌí¼ÓËæ»úÊý·ÀÖ¹ä¯ÀÀÆ÷cacheÒ³Ãæ
//½«·¢ÆðÕߣ¨ÈÎÎñËÞÖ÷£©IDÒ²´«½øPHP½Å±¾
var post_url= "checkURL.php?url=" + checkurl + "&id=" + $obj.id + "&random=" + Math.random()*(10000);

http_request_check_url.onreadystatechange=this.showCheckURLResult;//×¢²áÍê³ÉµÄ»Øµ÷º¯Êý
http_request_check_url.open("GET",post_url,true);
http_request_check_url.send(null);
}

//Íê³ÉµÄ»Øµ÷º¯Êý
this.showCheckURLResult = functio


Ïà¹ØÎĵµ£º

[ËÄÌìѧ»áajax]ѧϰajax½Ì³ÌµÚËÄÌì

ÔÚ HTML µÄÍⲿÎļþÖÐÒ»Ñù£¬±ê¼ÇµÄ×éÖ¯ÓëÆäÑùʽ¡¢¸ñʽºÍÐÐΪÊÇ·ÖÀëµÄ¡£ËäÈ»Äú¿Ï¶¨¿ÉÒÔÓà JavaScript ¸ü¸ÄÔªËØ»òÎı¾µÄÑùʽ£¬µ«Êµ¼Ê¸ü¸ÄÄúµÄ±ê¼ÇËù²¼ÖõÄ×é֯ȴ¸ü¼ÓÓÐȤ¡£
Ö»ÒªÀμÇÄúµÄ±ê¼ÇֻΪÄúµÄÒ³ÃæÌṩ×éÖ¯¡¢¿ò¼Ü£¬Äú¾ÍÄÜÁ¢ÓÚ²»°ÜÖ®µØ¡£ÔÙÇ°½øһС²½£¬Äú¾Í»áÃ÷°×ä¯ÀÀÆ÷ÊÇÈçºÎ½ÓÊÜËùÓеÄÎı¾×éÖ¯²¢½«Æäת±äΪ³¬¼¶ÓÐȤµ ......

ajax Ïê½â

ajax¾ÍÊÇjavascript ÒòΪÒÔÇ°javascriptûÓÐhttpXMLrequest¶ÔÏ󣬴ÓIE5.0Ö®ºó³öÏÖ£¬Ëµ°×ÁËajax¾ÍÊÇ¿ÉÒÔÓÃjavascriptÏò·þÎñÆ÷·¢ËÍÇëÇ󣬲¢ÇÒÄܽÓÊÕ·þÎñ·µ»ØµÄÄÚÈÝ,дajax³ÌÐòֻҪд³öÒ»¸ö·¢Ëͺ¯ÊýºÍÒ»¸ö½ÓÊÕ·þÎñÔ±·µ»ØµÄº¯Êý¼´¿É£¬ÔÚ·þÎñÆ÷³ÌÐòÖпÉÒÔ·µ»Ø×Ö·û´®Ò²¿ÉÒÔ·µ»Øxml£¬ÊµÀý³ÌÐòhttp://xsuo.javaeye.com/blog/578637 ......

¶ÔAjaxµÄһЩ»ù±¾Àí½â

Ò»¡¢ajaxµÄÈëÃÅ
  1¡¢XMLHttpRequest¶ÔÏóµÄʹÓã¨Ê¹ÓÃXMLHttpRequest½âÎöxmlÎļþ£©
 onreadystatechange
Ö¸¶¨µ±readyStateÊôÐԸıäʱµÄʼþ´¦Àí¾ä±ú
 open()
´´½¨Ò»¸öеÄhttpÇëÇ󣬲¢Ö¸¶¨´ËÇëÇóµÄ·½·¨¡¢URLµÈÐÅÏ¢
 send()
·¢ËÍÇëÇóµ½http·þÎñÆ÷²¢½ÓÊÕ»ØÓ¦
 readyState
&nb ......

AJAXÏ»ñÈ¡¸üÐÂÖµµÄÎÊÌ⣬δ½â¾ö

ʹÓÃAJAXÖеÄUpdatePanel
ÔÚUpdatePanelÖÐÌí¼ÓÒ»GridView,Ìí¼ÓÁËRow_Updatingʼþ£º protected void gvUnitList_RowUpdating(object sender, GridViewUpdateEventArgs e)
{
GridViewRow row = gvUnitList.Rows[e.RowIndex];
UnitModel unit = new UnitModel();
unit.UnitID = Convert.ToI ......

Js ·ÖÒ³Àà¡¡£¨ÊʺÏAjax·ÖÒ³Óã©

µ÷Ó÷½·¨ÈçÏÂ:
var p = new Pager(5, 10);
p.init('Ò³ÂëËùÔÚµÄÈÝÆ÷ID', dataOp);
function dataOp() {
// ajaxÊý¾Ý²Ù×÷
SendContent("/Admin/TopicService.asmx/GetTopicList?currentPageIndex=" + p.currentPage + "&pageSize=" + p.pageSize, "GET", "", ajax ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ