Ò׽ؽØͼÈí¼þ¡¢µ¥Îļþ¡¢Ãâ°²×°¡¢´¿ÂÌÉ«¡¢½ö160KB
ÈÈÃűêÇ©£º c c# c++ asp asp.net linux php jsp java vb Python Ruby mysql sql access Sqlite sqlserver delphi javascript Oracle ajax wap mssql html css flash flex dreamweaver xml
 ×îÐÂÎÄÕ : ajax

AjaxÖеÄreadyStateºÍstatus

AjaxÖеķµ»Ø״̬readyStateºÍstatus,Ô­À´Ã»ÓÐÖØÊÓ¹ýÕâÁ½ÕߵĹØϵ£¬½á¹û½ñÌìд´úÂëʱ³ö²î´íÁË¡£ÎÒµÄÔ­´úÂëΪ£º
function requestSome()
{
  url=......
  xmlHttpRequest.open....
  xmlHttpRequest.onreadystatechange = function responseSome();
  xmlHttpRequest.send....
}
function responseSome()
{
  if(xmlHttpReqeust.readyState == 4)
  {
    alert(xmlHttpRequest.responseText);
    .....
    .....
  }
}
ÎÒÐèÒªµÃµ½Ò»Ð©ºÏ·¨µÄ·µ»ØÊý¾Ý²¢¶ÔÖ®½øÐд¦Àí£¬µ«·µ»Ø½á¹ûºÜÀëÆ棬ÎÒalert³öµÄ½á¹ûΪ£º<html><head><title>Apache Tomcat/5.5.26 - Error report</title><style><!--H1 {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;font-size:22px;} H2 {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;font-size:16px;} H3 {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;font-size:14px;} BODY {font-family:Tahoma,Arial,sans-serif ......

Jquey Ajax·ÃÎÊasp.netºǫ́´úÂë

            $.ajax({
                type: "POST",   //·ÃÎÊWebServiceʹÓÃPost·½Ê½ÇëÇó
                contentType: "application/json",
                url: "UpdateNews.aspx/InsertLocalImages",
                data: "{dirName:'" + UploadPath + "',ImagePath:'" + imgpath + "',ImageName:'" + imgname + "',filetitle:'" + title + "',filedate:'" + date + "',fileexp:'" + exp + "',filekeyw:'" + keyw + "',iscovr:'" + iscovr + "'}",
                dataType: 'json',
                succ ......

Jquey Ajax·ÃÎÊasp.netºǫ́´úÂë

            $.ajax({
                type: "POST",   //·ÃÎÊWebServiceʹÓÃPost·½Ê½ÇëÇó
                contentType: "application/json",
                url: "UpdateNews.aspx/InsertLocalImages",
                data: "{dirName:'" + UploadPath + "',ImagePath:'" + imgpath + "',ImageName:'" + imgname + "',filetitle:'" + title + "',filedate:'" + date + "',fileexp:'" + exp + "',filekeyw:'" + keyw + "',iscovr:'" + iscovr + "'}",
                dataType: 'json',
                succ ......

ajaxʵÀý

//³õʼ»¯¶ÔÏó²¢·¢³öXMLHttpRequestÇëÇó
 xmlHttp= false;
 if (window.XMLHttpRequest)
 {           //MozillaµÈÆäËûä¯ÀÀÆ÷
  xmlHttp= new XMLHttpRequest();
   if (xmlHttp.overrideMimeType)
   {
   xmlHttp.overrideMimeType("text/xml"); /*Èç¹ûÀ´×Ô·þÎñÆ÷µÄÏìӦûÓÐ XML mime-type Í·²¿(header)£¬ÔòһЩ°æ±¾µÄ Mozillaä¯ÀÀÆ÷²»ÄÜÕý³£ÔËÐС£¶ÔÓÚÕâÖÖÇé¿ö£¬httpRequest.overrideMimeType('text/xml'); Óï¾ä½«¸²¸Ç·¢Ë͸ø·þÎñÆ÷µÄÍ·²¿£¬Ç¿ÖÆ text/xml ×÷Ϊ mime-type¡£*/
   }
 }
 else if (window.ActiveXObject)
 {         //IEä¯ÀÀÆ÷
   try
   {   //Microsoft ä¯ÀÀÆ÷ Internet Explorer ʹÓà MSXML ½âÎöÆ÷´¦Àí XML
    xmlHttp= new ActiveXObject("Msxml2.XMLHTTP"); //³¢ÊÔʹÓÃÒ»¸ö°æ±¾µÄ MSXML ´´½¨¶ÔÏó£¬Èç¹ûʧ°ÜÔòʹÓÃÁíÒ»¸ö°æ±¾´´½¨¸Ã¶ÔÏó¡£
   }
   catch (e)
   {
& ......

jQuery Ajax È«½âÎö

jQueryȷʵÊÇÒ»¸öͦºÃµÄÇáÁ¿¼¶µÄJS¿ò¼Ü£¬ÄÜ°ïÖúÎÒÃÇ¿ìËٵĿª·¢JSÓ¦Ó㬲¢ÔÚÒ»¶¨³Ì¶ÈÉϸıäÁËÎÒÃÇдJavaScript´úÂëµÄÏ°¹ß¡£
·Ï»°ÉÙ˵£¬Ö±½Ó½øÈëÕýÌ⣬ÎÒÃÇÏÈÀ´¿´Ò»Ð©¼òµ¥µÄ·½·¨£¬ÕâЩ·½·¨¶¼ÊǶÔjQuery.ajax()½øÐзâ×°ÒÔ·½±ãÎÒÃÇʹÓõķ½·¨£¬µ±È»£¬Èç¹ûÒª´¦Àí¸´ÔÓµÄÂß¼­£¬»¹ÊÇÐèÒªÓõ½jQuery.ajax()µÄ(Õâ¸öºóÃæ»á˵µ½).
1. load( url, [data], [callback] ) £ºÔØÈëÔ¶³Ì HTML Îļþ´úÂë²¢²åÈëÖÁ DOM ÖС£
url (String) : ÇëÇóµÄHTMLÒ³µÄURLµØÖ·¡£
data (Map) : (¿ÉÑ¡²ÎÊý) ·¢ËÍÖÁ·þÎñÆ÷µÄ key/value Êý¾Ý¡£
callback (Callback) : (¿ÉÑ¡²ÎÊý) ÇëÇóÍê³Éʱ(²»ÐèÒªÊÇsuccessµÄ)µÄ»Øµ÷º¯Êý¡£
Õâ¸ö·½·¨Ä¬ÈÏʹÓà GET ·½Ê½À´´«µÝµÄ£¬Èç¹û[data]²ÎÊýÓд«µÝÊý¾Ý½øÈ¥£¬¾Í»á×Ô¶¯×ª»»ÎªPOST·½Ê½µÄ¡£jQuery 1.2 ÖУ¬¿ÉÒÔÖ¸¶¨Ñ¡Ôñ·û£¬À´É¸Ñ¡ÔØÈëµÄ HTML Îĵµ£¬DOM Öн«½ö²åÈëɸѡ³öµÄ HTML ´úÂë¡£Óï·¨ÐÎÈç "url #some > selector"¡£
Õâ¸ö·½·¨¿ÉÒԺܷ½±ãµÄ¶¯Ì¬¼ÓÔØһЩHTMLÎļþ£¬ÀýÈç±íµ¥¡£
ʾÀý´úÂ룺
$(".ajax.load").load("http://www.cnblogs.com/QLeelulu/archive/2008/03/30/1130270.html .post",
function (responseText, textStatus, XMLHttpRequest){
this;//ÔÚÕâÀ ......

AJAXµÄºËÐÄ

XMLHttpRequestÊÇAjax¼¼ÊõÌåϵÖÐ×îΪºËÐĵļ¼Êõ¡£È±ÉÙÁËËü£¬AjaxµÄÆäÓ༼Êõ¾ÍÎÞ·¨³ÉΪһ¸öÓлúµÄÕûÌ壬½«»áÍÁ±ÀÍ߽⡣
¡¡¡¡1999ÄêÉÏ°ëÄ꣬MSÔÚIE 5.0°æÖÐÊ×´ÎÖ§³ÖÕâÖÖ¼¼Êõ£¬ËûÃÇÊÇͨ¹ýÒ»¸öÃûΪXMLHTTPµÄActiveX¶ÔÏóÀ´Ö§³ÖÕâÖÖ¼¼ÊõµÄ¡£XMLHTTP¶ÔÏóʹµÃÒ³ÃæÖеĽű¾¾ßÓÐÁËÔÚ²»Ë¢ÐÂÒ³ÃæµÄÇé¿öÏÂÖ±½ÓÓë·þÎñÆ÷ͨÐŵÄÄÜÁ¦¡£ÔÚ´Ë֮ǰ£¬Äܹ»×öµ½Õâ¼þʵÄΨһ¼¼ÊõÊÇͨ¹ýIFrame£¬È»¶øÕⳬԽÁËIFrame×î³õÉè¼ÆµÄÄ¿±ê£¬ÊÇÒ»ÖÖ´æÔÚDZÔÚΣÏÕµÄhack×ö·¨¡£¼ÈÈ»ÒѾ­Óкܶ಻Êعæ¾ØµÄ¿ª·¢Õß×ö³öÁËÔ½¹ìµÄÐÐΪ£¬²¢ÇÒÊÂʵ֤Ã÷ÕâÑùµÄ¿ª·¢·½Ê½È·Êµ·Ç³£ÓмÛÖµ£¬Ò²²»»á¶Ôϵͳ°²È«Ôì³ÉʲôÆÆ»µ¡£ÓÚÊÇMS¾Í´ÓÉÆÈçÁ÷µØ·¢Ã÷ÁËXMLHTTP¶ÔÏó£¬×¨ÃÅÓÃÀ´Îªä¯ÀÀÆ÷ÖеĽű¾£¨ÔÚIEÖоÍÊÇJScriptºÍVBScript£©ÌṩÕâÑùµÄ·þÎñÆ÷ͨÐÅÄÜÁ¦¡£
¡¡¡¡XMLHTTP¶ÔÏó´óÊÜ»¶Ó­£¬µ½ÁË2000ÄêËü¼¸ºõÒѾ­³ÉΪÁËÊÂʵÉϵıê×¼¡£MozillaÔÚÕâÒ»ÄêʵÏÖÁ˾ßÓÐÏàͬ½Ó¿ÚµÄÔ­Éú¶ÔÏ󣬳Æ×÷XMLHttpRequest¶ÔÏ󡣺óÀ´Opera¡¢SafariµÈä¯ÀÀÆ÷Ò²¶¼Ïà¼ÌʵÏÖÁËXMLHttpRequest¶ÔÏó¡£ÏÖÔÚXMLHttpRequestÊÇÕâ¸ö¼¼ÊõµÄÕýʽÃû³Æ¡£
¡¡¡¡AjaxËùÒÀÀµµÄ¼¼ÊõÖ®ÖÐΨһһ¸öÉÐδÕýʽ±ê×¼»¯µÄ²¿·Ö¾ÍÊÇXMLHttpRequest£¬²»¹ýÏÖÔÚW3CÒѾ­½«ÆäÁÐÈëÁ˹¤×÷²Ý°¸£¬Ó¦¸ÃºÜ¿ì¾Í» ......

AjaxÌá½»Êý¾Ý¸üзþÎñÆ÷neir

  1£¬±¾Àý×ÓʵÏÖÒ»¸öAjax¸ü¸ÄÊý¾ÝµÄÀý×Ó
Èçͼ£º
1£¬Ð½¨xmlÎļþ£»ÆäÄÚÈÝÈçÏ£º
<?xml version="1.0" encoding="utf-8"?>
<userinfo>
<user>
<id>I</id>
<name>wtq</name>
<password>123456</password>
<phone>0595-85538649</phone>
<city>ȪÖÝ</city>
</user>
<user>
<id>1</id>
<name>1</name>
<password>1</password>
<phone>1</phone>
<city>1</city>
</user>
<user>
<id>1</id>
<name>1</name>
<password>1</password>
<phone>1</phone>
<city>1</city>
</user>
<user>
<id>123</id>
<name>ÍõÌìÇÉ</name>
<password>123</password>
<phone>13616009873</phone>
<city>jinjiang</city>
</user>
< ......
×ܼǼÊý:703; ×ÜÒ³Êý:118; ÿҳ6 Ìõ; Ê×Ò³ ÉÏÒ»Ò³ [13] [14] [15] [16] 17 [18] [19] [20] [21] [22]  ÏÂÒ»Ò³ βҳ
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ