AjaxµÄjs·â×°
function send_request(callback, urladdress, isReturnData){
var xmlhttp = getXMLHttpRequest();
xmlhttp.onreadystatechange = function(){
if (xmlhttp.readyState == 4) {//readystate Ϊ4¼´Êý¾Ý´«Êä½áÊø
try{
if(xmlhttp.status == 200){
if(isReturnData && isReturnData==true){
callback(xmlhttp.responseText);
}
}else{
callback("±§Ç¸£¬Ã»ÕÒµ½´ËÒ³Ãæ:"+ urladdress +"");
}
} catch(e){
callback("±§Ç¸£¬·¢ËÍÇëÇóʧ°Ü£¬ÇëÖØÊÔ " + e);
}
Ïà¹ØÎĵµ£º
/*
κÑÔAJAX Àà
ʹÓ÷½·¨:
<mce:script type="text/javascript"><!--
var classAjax = new Ajax(sUrl,sRecvTyp,sQueryString,oResultFunc);
classAjax.post();//post·½Ê½·¢ËÍÊý¾Ý
classAjax.get();//get·½Ê½·¢ËÍÊý¾Ý
//sUrl·¢Ë͵ØÖ·
//sRecvTyp ½ÓÊÜÊý¾ÝÀàÐÍ:0Ϊxml 1Ϊtext
//oResultFunc ·µ»Ø½á¹û´¦Àíº ......
ǰ¼¸ÌìÔÚFirebugÀ©Õ¹¿ª·¢Ò»ÎÄÖоÍÌáµ½¹ýFirephpÕâ¸ö»ùÓÚFirebugµÄ²å¼þ£¬Í¨¹ýʹÓÃFirephpÄã¿ÉÒÔÔÚFirebugµÄConsoleÀ¸Öп´µ½Òªµ÷ÊÔµÄÊý¾Ý£¬¶ø²»Ó°Ïìphp³ÌÐòµÄÕý³£Ö´ÐУ¬ËùÒÔ˵£¬Õâ¶«Î÷¶ÔÓÚAjax¿ª·¢ÊǺÜÓаïÖúµÄ£¡ÏÂÃæÒ»ÆðÀ´¿´ÏÂFirephpµÄʹÓ÷½·¨¡£
µÚÒ»²½£º°²×°
1.Èç¹ûÄãµÄFireFoxûÓÐFirebugÕâ¸ö²å¼þµÄ»°£¬Ê×ÏÈÒª°²×°Fire ......
±¾ÎĵØÖ·: jQuery Ajax È«½âÎö
±¾ÎÄ×÷ÕߣºQLeelulu
×ªÔØÇë±êÃ÷³ö´¦£¡
jQueryȷʵÊÇÒ»¸öͦºÃµÄÇáÁ¿¼¶µÄJS¿ò¼Ü£¬ÄܰïÖúÎÒÃÇ¿ìËٵĿª·¢JSÓ¦Ó㬲¢ÔÚÒ»¶¨³Ì¶ÈÉϸıäÁËÎÒÃÇдJavaScript´úÂëµÄϰ¹ß¡£
·Ï»°ÉÙ˵£¬Ö±½Ó½øÈëÕýÌ⣬ÎÒÃÇÏÈÀ´¿´Ò»Ð©¼òµ¥µÄ·½·¨£¬ÕâЩ·½·¨¶¼ÊǶÔjQuery.ajax()½øÐзâ×°ÒÔ·½±ãÎÒÃÇʹÓõķ½·¨£¬µ±È»£¬Èç¹ ......
¾ÅÊ®Äê´úÖÐÆÚ£¬WWWÒÔѸÃÍÖ®ÊÆ×ªÑÛõÒÉí´«²¥ÐÅÏ¢µÄÖ÷ÒªÇþµÀÖ®Ò»¡£ä¯ÀÀÆ÷µÄÉíÓ°¿ªÊ¼ÎÞ´¦²»ÔÚ£¬Óû§Ò²ËæÖ®¿ªÊ¼ÊÊÓ¦ÕâÖÖÐÅÏ¢´«²¥·½Ê½¡£ÏÔÈ»£¬WWWÌṩµÄÓ¦ÓÃÆ½Ì¨Äܹ»Ó®µÃÀúÊ·ÉÏÈκÎÒ»¸öƽ̨¶¼ÎÞ·¨±È¼°µÄÓû§Á¿¡£µ«µ±Ê±ºÜÄÑʵÏÖÕâÑùµÄÄ¿±êÊÇÒòΪһЩ±ê×¼£¨HTML¡¢HTTPµÈ£©¶¼²»ºÜÍêÉÆ£¬ÕâЩ±ê×¼Éè¼ÆµÄʱºò¶¼Ã»Óп¼Âǵ½¸ß¶È½»»¥ºÍ¸»¿Í ......