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;color:black;background-color:white;} B {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;} P {font-family:Tahoma,Arial,sans-serif;background:white;color:black;font-size:12px;}A {color : black;}A.name {color : black;}HR {color : #525D76;}--></style> </head><body><h1>HTTP Status 404 - /xxxxx</h1><HR size="1" noshade="noshade"><p><b>type</b> Status report</p><p><b>message</b> <u>/adminConsolfasdf</u></p><p><b>description</b> <u>The requested resource (/adminConsolfasdf) is not available.</u></p><HR size="1" noshade="noshade"><h3>Apache Tomcat/5.5.26</h3></body></html>
ÎÒдµÄÒ³ÃæÖÐûÓÐÄĸöÊÇÕâÖÖµÄѽ£¬Ôõô»á·µ»ØÕâÖÖ½á¹û£¬ºÜ¹îÒ죬×îºó²Å·¢ÏÖÕâÊÇtomcat·µ»Ø404µÄ´íÎóÒ³ÃæµÄhtml¡£ÔÒòÊÇÏîÄ¿ÔÚlinuxµÄ·þÎñÆ÷¶Ë×ñѵÄÊÇhttpsÐÒ飬¶øÎҵı¾µØÊÇhttp¡£ÔÀ´µÄAjaxÇëÇóurlÊÇhttps,ËùÒ
Ïà¹ØÎĵµ£º
ajaxÖÐXMLHttpRequest²ÎÊýÏê½â ÊÕ²Ø
XJAX ,²¢²»ÊÇÒ»ÖÖÐÂ[url=javascript:;]¼¼Êõ[/url]µÄµ®Éú.Ëüʵ¼ÊÉÏ´ú±íµÄÊǼ¸Ïî¼¼Êõ°´Ò»¶¨µÄ·½Ê½×éºÏÔÚÒ»ÔÚͬ¹²µÄÐ×÷Öз¢»Ó¸÷×ÔµÄ×÷ÓÃ.
Ëü°üÀ¨£º
ʹÓÃXHTMLºÍ[url=javascript:;]CSS[/url]±ê×¼»¯³ÊÏÖ£»
ʹÓÃDOMʵÏÖ¶¯Ì¬ÏÔʾºÍ½»»¥£»
ʹÓÃ[url=javascript:;]XML[/url]ºÍXSLT½øÐÐÊý ......
¼òµ¥µÄExt.Ajax. requestʾÀý
var requestConfig = {
url :'loginServer.jsp',//ÇëÇóµÄ·þÎñÆ÷µØÖ·
params : {userName : 'tom',password : '123'},//ÇëÇó²ÎÊý ......
jQuery Ajax ʵÀý È«½âÎö
Òý×Ô:http://www.pqshow.com/design/Javascript/200909/10473.html
jQueryȷʵÊÇÒ»¸öͦºÃµÄÇáÁ¿¼¶µÄJS¿ò¼Ü£¬ÄܰïÖúÎÒÃÇ¿ìËٵĿª·¢JSÓ¦Ó㬲¢ÔÚÒ»¶¨³Ì¶ÈÉϸıäÁËÎÒÃÇдJavaScript´úÂëµÄϰ¹ß¡£
·Ï»°ÉÙ˵£¬Ö±½Ó½øÈëÕýÌ⣬ÎÒÃÇÏÈÀ´¿´Ò»Ð©¼òµ¥µÄ·½·¨£¬ÕâЩ·½·¨¶¼ÊǶÔjQuery.ajax()½øÐзâ×°ÒÔ·½±ãÎÒÃÇ ......
<html xmlns="http://www.w3.org/1999/xhtml" >
<head>
<title>xmlhttprequest ajax demo</title>
<mce:script type ="text/javascript" language ="javascript" ><!--
var req; //¶¨Òå±äÁ¿£¬ÓÃÀ´´´½¨xmlhttprequest¶ÔÏó
function creatReq() // ´´½¨xmlhtt ......
var x,y;
//ÕâÊÇÒ»¸öͨ¹ýAJAXÈ¡µÃÌáʾÐÅÏ¢µÄ·½·¨
function over(noteContent){
//¼Ç¼Ê¼þ·¢ÉúʱµÄÊó±êλÖÃ
x = event.clientX;
y = event.clientY;
//ÏÔʾ¹¤¾ßÌáʾ
document.getElementById(" ......