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

ajaxÈýÑÔÁ½Óï(Ö±½Ó½«xmlhttp·µ»ØÖµ½øÐÐjs´úÂë´¦Àí)


ÕâÀïµÄajax¿É²»ÊÇ´óÃû¶¦¶¦µÄajax¾ãÀÖ²¿£¬ ÕâËĸö×ÖĸÔÚÕâÀïAsynchronous JavaScript and XMLµÄËõд¡£Í¨Ë×µØÃèÊöÕâÏî¼¼Êõ¾ÍÊÇ£ºÓà JavaScript Ïò·þÎñÆ÷»ñÈ¡Êý¾Ý£¬È»ºó¸üÐÂÍøÒ³µÄ¾Ö²¿£¬¶ø²»ÊÇË¢ÐÂÕû¸öÍøÒ³¡£
ÕâÏî¼¼Êõ·Ç³£ÊʺÏÓÃÀ´¿ª·¢ÒÔä¯ÀÀÆ÷Ϊ¿Í»§¶ËµÄϵͳµÄ½çÃ棬ʹÓÃajax¸øÓû§´øÀ´µÄ¸üºÃµÄÌåÑ飬ËûÃDz»»á¸Ð¾õµ½ÓÃä¯ÀÀÆ÷¿ª·¢µÄ¿Í»§¶ËÓë×ÀÃæ³ÌÐòÓÐʲô²î±ð¡£
ajaxʹÓÃÁ˱Ƚ϶àµÄjavacript£¬²¢ÐèÒª·ÃÎʺܶàdom¶ÔÏó£¬Õâ³£³£¸ø¿çä¯ÀÀÆ÷·ÃÎÊ´øÀ´À§ÈÅ¡£µ«¼ÙÈçÄãСÐÄÓ¦¶Ô£¬»¹ÊÇÈÝÒ×½â¾öÕâ¸öÎÊÌâµÄ¡£±ÈÈ磬ÄãÏë´Ó·þÎñÆ÷¶Î»ñµÃһЩÊý¾Ý£¬Äã±ØȻҪÓõ½xmlhttp£¬ÎªÁËÈóÌÐòä¯ÀÀÆ÷Î޹أ¬Äã¿ÉÒÔÕâÑù´´½¨xmlhttp¶ÔÏó£º
//for IE
var xmlhttp=false;
try {
xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
} catch (e) {
try {
xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
} catch (E) {
xmlhttp = false;
}
}
//for firefox
if (!xmlhttp && typeof XMLHttpRequest!='undefined') {
xmlhttp = new XMLHttpRequest();
}
ÔںܶàµÄajax·¶ÀýÖУ¬¿ª·¢Õ߶¼ÊÇÓÃxmlhttp´Ó·þÎñÆ÷¶Ë»ñµÃÒ»¸öxmlÊý¾Ý£¬È»ºóת»»³Éjavascript¿É´¥¼°µÄ¶ÔÏó£¬ÔÙÓÃjs»æÖƵ½documentÖС£µ«ÎÒ¾õµÃÕâ²¢·ÇΨһѡÏÎÒÉõÖÁ¾õµÃÊǶà´ËÒ»¾Ù£¡ÎªÊ²Ã´²»Ö±½Ó´«µÝjs¶ÔÏóÄØ£¿ÔÚÎÒ¿ª·¢µÄϵͳÖУ¬xmlhttp´Ó·þÎñÆ÷ÉÏ»ñµÃµÄÊÇ´ú±íjs¶ÔÏóµÄ×Ö·û´®¡£¼ÙÈçÎÒÒª´«ËÍÒ»¸öÈËÔ±ÁÐ±í£¬ÎÒ»áÔÚ·þÎñÆ÷ÉÏÊä³ö£º
[{id:1,name:"hexiaodong"},{id:2,name:"mary"},{id:3,name:"name"},...]}
È»ºóÔÚä¯ÀÀÆ÷ÉÏÓÃjs»ñµÃÕâ¸ö×Ö·û´®Ëù´ú±íµÄ¶ÔÏó£º
var returned = xmlhttp.responseText;
var obj = eval(returned );
½Ó×Å£¬Äã¾Í¿ÉÒÔÕâÑù·ÃÎÊ£º
var person1 = obj[0]; var person2 = obj[1];
alert(person1.id);
alert(person1.name);
ÕâÑù×öȷʵÊÇÓÖ¼òµ¥ÓÖ½ÚÔ¼×ÊÔ´
²»¹ýÎÒÒ»Ö±ÏëÓÃxml¸ñʽµÄÀ´¶ÁÈ¡..µ«ÊÇû³É¹¦²»ÖªµÀÊÇʲôԭÒò¡£


Ïà¹ØÎĵµ£º

´«ÖDz¥¿ÍAjaxÊÓƵºó¼¯ÊÓƵËæ±Ê

 ===============ÏÂÆ­Ajax
================
ʮһ¡¢µÚʮһ¿Î   ===¡· ʹÓÃXHR¶ÔÏó·¢ËͺͽÓÊÜÊý¾Ý
a.¼ÌÐøÉÏÃæ²½Öè
2)×¢²á»Øµ÷º¯Êý,ֻдº¯ÊýÃû³Æ(Èç¹û¼ÓÁËÀ¨ºÅ£¬ÄÇô¾Í°Ñº¯Êý·µ»ØÖµ×¢²á¸ø»Øµ÷º¯Êý)
xmlHttp.onreadystatechange = callback;
3)ÉèÖÃÁ¬½ÓÐÅÏ¢
//µÚÒ»²ÎÊýÊÇHttpÇëÇó·½Ê½£¬Ò»°ãÑ¡Ôñget¡¢pos ......

visual studio 2008 °²×°AJAX Version 3.0.30930

1.µ½http://ajaxcontroltoolkit.codeplex.com/Release/ProjectReleases.aspx?ReleaseId=33804
ÏÂÔØAJAX Control Toolkit - Binary
2.½âѹµ½C:\Program Files\Microsoft.NET\ADOMD.NET\90
3.visual studio н¨Ò»ÍøÕ¾£¬Ë«»÷default.aspx
4.´ò¿ª¹¤¾ßÏ䣬ÓÒ»÷н¨Ò»Ñ¡Ï£¬Ã÷ÃûΪAjax Control Toolkit
5.ÓÒ»÷Ajax Contr ......

Ajax ½øÐÐPost´«ÖµºÍGet´«Öµ £¨¾­µä£©

<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
</head>
<script language="javascript">
function saveUserInfo()
{
//»ñÈ¡½ÓÊÜ·µ»ØÐÅÏ¢²ã
var msg = document.getElementById("msg");
//»ñÈ¡±íµ¥¶ÔÏóºÍÓ ......

³õʶAjax¼¼Êõ1

Ò» ÒýÌâ
ÈçºÎÈÃweb³ÌÐòÓÃÆðÀ´Ïñ×ÀÃæÓ¦ÓóÌÐòÒ»Ñù¼òµ¥£»
ÅÖ¿Í»§¶Ë£¿ÊÝ¿Í»§¶Ë£¿ÈçºÎÑ¡Ôñ£¿-----¿´ÐèÇ󣬿´Óû§µÄʹÓã¬Áé»îµ÷½Ú¡£
²»ÒªÉÁ˸£¬¿Õ°×Ò³³öÏÖ£¿
 
¶þ ³õʶAjax
1.    AjaxÊÇÒ»¸ö¿Í»§¶Ë¼¼Êõ£¬²»ÂÛÄãÏÖÔÚʹÓúÎÖÖ·þÎñÆ÷¶Ë¼¼Êõ£¬¶¼ÄÜʹÓÃAjax£¬¶ø²»¹ÜʹÓõÄÊÇJava¡¢.NET¡¢Ruby¡¢PHP»¹ÊÇCGI¡ ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ