AjaxÀïµÄonreadystatechangeµÄ×÷ÓÃÊÇʲô
·¢ËÍÒ»¸öÇëÇóºó£¬¿Í»§¶ËÎÞ·¨È·¶¨Ê²Ã´Ê±ºò»áÍê³ÉÕâ¸öÇëÇó£¬ËùÒÔÐèÒªÓÃʼþ»úÖÆÀ´²¶»ñÇëÇóµÄ״̬£¬XMLHttpRequest¶ÔÏóÌṩÁËonreadyStateChangeʼþʵÏÖÕâÒ»¹¦ÄÜ¡£ÕâÀàËÆÓڻص÷º¯ÊýµÄ×ö·¨¡£
onreadyStateChangeʼþ¿ÉÖ¸¶¨Ò»¸öʼþ´¦Àíº¯ÊýÀ´´¦ÀíXMLHttpRequest¶ÔÏóµÄÖ´Ðнá¹û£¬È磺
ajaxObj=createAjaxObject();
var url="/MyTodoes/FetchText?id="+id;
ajaxObj.open("Get",url,true);
ajaxObj.onreadyStateChange=changeTabCallBack;
ajaxObj.send(null);
onreadyStateChangeʼþÊÇÔÚreadyStateÊôÐÔ·¢Éú¸Ä±äʱ´¥·¢µÄ£¬readyStateµÄÖµ±íʾÁ˵±Ç°ÇëÇóµÄ״̬£¬ÔÚʼþ´¦Àí³ÌÐòÖпÉÒÔ¸ù¾ÝÕâ¸öÖµÀ´½øÐв»Í¬µÄ´¦Àí¡£ readyStateÓÐÎåÖÖ¿Éȡֵ0£ºÉÐδ³õʼ»¯£¬1£ºÕýÔÚ¼ÓÔØ£¬2£º¼ÓÔØÍê±Ï£¬3£ºÕýÔÚ´¦Àí£»4£º´¦ÀíÍê±Ï¡£Ò»µ©readyStateÊôÐÔµÄÖµ±ä³ÉÁË4£¬¾Í¿ÉÒÔ´Ó·þÎñÆ÷·µ»ØµÄÏìÓ¦Êý¾Ý½øÐзÃÎÊÁË¡£
ͨ³£ÔÚʼþÖÐÅжÏreadyStateµÄÖµÊÇÔÚÇëÇóÍê±Ïʱ²Å×ö´¦Àí£¬È磺
function changeTabCallBack(){
if(ajaxObj.readyState==4){
// ÏÂÒ»²½ÑéÖ¤
}
}
Status´æ´¢ÁË·þÎñÆ÷¶Ë·µ»ØµÄHttpÇëÇóÏìÓ¦´úÂ룬Ëü±íʾÇëÇóµÄ´¦Àí½á¹û£¬³£¼ûÏìÓ¦´úÂëµÄº¬ÒåÈçÓÒ¡£
ÔÚAjax¿ª·¢ÖУ¬×î³£ÓþÍÊÇ200Õâ¸öÏìÓ¦Â룬´úÂëÈçÏ£º
function changeTabCallBack(){
if(ajaxObj.readyState==4){
if(ajaxObj.status==200){
// ·þÎñ¶Ë·µ»ØÁËÕýÈ·Êý¾Ý£¬¿ªÊ¼ÏìÓ¦´¦Àí
}
}
}
Http״̬Âë º¬Òå
200 ÇëÇó³É¹¦
202 ÇëÇó±»½ÓÊܵ«´¦ÀíδÍê³É
400 ´íÎóÇëÇó
404 ÇëÇó×ÊԴδÕÒµ½
500 ÄÚ²¿·þÎñÆ÷´íÎó
Ïà¹ØÎĵµ£º
ÔÎĵØÖ·£ºhttp://sharethispoint.com/archive/2006/11/15/Build-web-parts-with-ajax.aspx
ÈçºÎÔÚ¿ª·¢Web²¿¼þʱʹÓÃajaxÄØ£¿ÎÒÃǽ«ÒÔÒ»¸öÑù×ÓÀàËÆMOSS 2007ÖÐKPIºÍBDC Web²¿¼þµÄWebPartΪÀýÀ´ËµÃ÷¡£Èç¹ûÄã¶ÔajaxÒ»µã¶¼²»Á˽â,ÍÆ¼öѧϰTerryLeeµÄajaxÈëÃÅϵÁС£
ASP.net2.0ÓÐÒ»¸öºÜ¿áµÄÐÂÌØÐÔ½Ð×÷¿Í»§¶Ë½Å±¾»Øµ÷¡£½Å±¾»Øµ ......
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<script type="text/ ......
1. Accordion
¡¾¹¦ÄܸÅÊö¡¿Accordion¿ÉÒÔÈÃÄãÉè¼Æ¶à¸öpanel ²¢ÇÒÒ»´ÎÖ»ÏÔʾһ¸öPanel .ÔÚÒ³ÃæÉϵÄÏÔʾЧ¹û¾ÍÏñÊÇʹÓÃÁ˶à¸öCollapsiblePanelsÖ»²»¹ýÿһ´ÎÖ»Õ¹¿ªÆäÖÐÒ»¸ö CollapsiblePanel.Accordion¿Ø¼þÄÚ²¿°üº¬ÁËÈô¸É¸öAccordionPane£¬Ã¿Ò»¸öAccordionPaneµÄ templateÀï°üÀ¨ÁË¶ÔÆäHeaderºÍContentµÄ¶¨Òå¡£ÎÒÃÇ¿ÉÒÔÔÚºǫ́ ......
×î½ü×ö¸öÈËÍøÕ¾Óöµ½AJAX¿ç×ÓÓòÃûµÄÎÊÌâ¡£
ż¶û¿´µ½baiduµÄͨÐÐÖ¤´¦Àí¶¼ÊÇÔÚ¶þ¼¶ÓòÃûpassport.baidu.comÖд¦ÀíµÄ£¬
µ«ÊÇbaiduºÜ¶àµØ·½µÇ¼¶¼ºÃÏñÊÇÓÃajax´¦ÀíµÄ£¬ËûÊÇÔõô×öµÄÄØ£¿Ñо¿ÁËһϣ¬·¢ÏÖÒ»¸öС¼¼ÇÉ¡£
²»·ÀÈôó¼ÒÒ²½è¼øÒ»Ï¡£
ÔÚhttp://zhidao.baidu.com/ δµÇ¼Óû§»Ø´ðÎÊÌâʱ»áÓÃiframeµ÷ÓÃhttp://zhidao.bai ......
1.ǰ¡¢¶Ëºó¶¼Òª×öºÃ°²È«µÄ°Ñ¹Ø¹¤×÷
ÓÉÓÚAjaxÒ²»á½ÓÊÕºó¶Ë´«ËÍÀ´µÄ×ÊÁÏ£¬¶ÔÕâЩ×ÊÁ϶¼Òª²É²»ÐÅÈÎ̬¶È£¬±ØÐë¼ÓÒÔ¼ì²é¡£
2.¾¡Á¿ÒÔHTTP POST·½·¨´«Êä×ÊÁÏ
ËäÈ»POST²¢·ÇÍòÎÞһʧ£¬µ«±ÈÆðGETÖÁÉÙ½ÏΪ°²È«¡£
3.²»ÒªÖ±½ÓÓÃevalº¯Ê½»½ÆðJSONÎï¼þ
JSONÊDzÉÓÃJavaScriptÎï¼þʵ×ÖµÄ×ÊÁϸñʽ£¬´Óºó¶Ë´«µ½Ajax³Ìʽʱ£¬±ØÐë²ÉÓÃevalº ......