¶ÔAjaxµÄһЩ»ù±¾Àí½â
Ò»¡¢ajaxµÄÈëÃÅ
1¡¢XMLHttpRequest¶ÔÏóµÄʹÓã¨Ê¹ÓÃXMLHttpRequest½âÎöxmlÎļþ£©
onreadystatechange
Ö¸¶¨µ±readyStateÊôÐԸıäʱµÄʼþ´¦Àí¾ä±ú
open()
´´½¨Ò»¸öеÄhttpÇëÇ󣬲¢Ö¸¶¨´ËÇëÇóµÄ·½·¨¡¢URLµÈÐÅÏ¢
send()
·¢ËÍÇëÇóµ½http·þÎñÆ÷²¢½ÓÊÕ»ØÓ¦
readyState
·µ»ØXMLHTTPÇëÇóµÄµ±Ç°×´Ì¬
status
·µ»Øµ±Ç°ÇëÇóµÄhttp״̬Âë
responseText
½«ÏìÓ¦ÐÅÏ¢×÷Ϊ×Ö·û´®·µ»Ø
responseXML
½«ÏìÓ¦ÐÅÏ¢¸ñʽ»¯ÎªXml Document¶ÔÏó²¢·µ»Ø
out»ØÓ¦¿Í»§
£±¡¢“Ìí¼ÓÐÂÏî” Ð½¨Ò»¸öXMLÎļþÀ´´æ·ÅÒª±»µ÷ÓõÄÊý¾Ý¡£
XMLFile.xml
<?xml version="1.0" encoding="utf-8" ?>
<response>
<res>
¶Ô²»Æð,µÇ¼ʧ°Ü!
</res>
</response>
£²¡¢“Ìí¼ÓÐÂÏî” Ð½¨Ò»¸öJSPÒ³£¬Ìí¼Ó´úÂ룺
<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<!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>
<title>AjaxÒì²½µ÷ÓÃ</title>
</head>
<body>
<div style="background-color:Yellow" id="mytext">AjaxÒì²½µ÷ÓÃ
</div>
<input type="button" value="¸üÐÂ" onclick="startHTTP()" />
</body>
</html>
<script type="text/javascript">
var XMLHttpReq;
function createHTTP(){
//¸ù¾Ý²»Í¬µÄä¯ÀÀÆ÷´´½¨XMLHttpRequest
if(window.ActiveXObject)//ieä¯ÀÀÆ÷
{
XMLHttpReq=new ActiveXObject("Microsoft.XMLHTTP");
}
else if(window.XMLHttpRequest){//ÆäËûä¯ÀÀÆ÷
XMLHttpReq=new XMLHttpRequest();
}
}
//¿ªÊ¼µ÷ÓÃ
function startHTTP()
{
Ïà¹ØÎĵµ£º
×î½üÍøÉÏÌáµÄºÜ¶àµÄÒ»¸öиÅÄî¾ÍÊÇ AJAX ÁË, ÄÇô, AJAX ÊÇʲôÄØ? ÒÔÏÂÄÚÈÝÒýÓÃÍøÉÏ×ÊÁÏ:
AJAXÈ«³ÆΪ“Asynchronous JavaScript and XML”£¨Òì²½JavaScriptºÍXML£©£¬ÊÇÖ¸Ò»ÖÖ´´½¨½»»¥Ê½ÍøÒ³Ó¦ÓõÄÍøÒ³¿ª·¢¼¼Êõ¡£ËüÓлúµØ°üº¬ÁËÒÔϼ¸ÖÖ¼¼Êõ£º
Ajax£¨Asynchronous JavaScript + XML£©µÄ¶¨Òå
»ùÓÚ web±ê×¼£¨sta ......
¸ÃʵÀýÊ×ÏÈÐèÒª´´½¨Êý¾Ý¿â£¬Êý¾Ý¿âTestΨһ±ítest,¸Ã±í¾ßÓÐÈý¸öÁзֱðΪc1,c2,c3, intÐÍ£¬Çë×ÔÐн¨Á¢Êý¾Ý¿â²¢²åÈ뼸ÐвâÊÔÊý¾Ý¡£
È»ºóÎÒÃÇÏ£ÍûÄܽ«Êý¾Ý¿âÖеÄÊý¾Ý¶ÁÈ¡³öÀ´£¬ÎÒÔÚ´Ë´¦Ö»Êǽ«Êý¾Ý¿âÊý¾ÝÒÔÊý¾Ý¼¯µÄ·½Ê½´æ·ÅÔÚ±¾µØÖУ¬ ......
Ajax(Asynchronous JavaScript and XML)ÊÇÒ»¸ö½áºÏÁËJava¼¼Êõ¡¢XML¡¢ÒÔ¼°JavaScriptµÄ±à³Ì¼¼Êõ£¬¿ÉÒÔÈÃÄã¹¹½¨»ùÓÚJava¼¼ÊõµÄWebÓ¦Ó㬲¢´òÆÆÁËʹÓÃÒ³ÃæÖØÔصĹßÀý¡£
Ajax£¬Òì²½JavaScriptÓëXML£¬ÊÇʹÓÿͻ§¶Ë½Å±¾ÓëWeb·þÎñÆ÷½»»»Êý¾ÝµÄWebÓ¦Óÿª·¢·½·¨¡£ÕâÑù£¬WebÒ³Ãæ²»Óôò¶Ï½»»¥Á÷³Ì½øÐÐÖØмӲ㬾ͿÉÒÔ¶¯Ì¬µØ¸üС£Ê ......
¸Ã¿Ø¼þ¿ÉÒÔʵÏÖÔÚÒ³ÃæÖе¯³öÒ»¸ö´°¿Ú£¬Õâ¸ö´°¿Ú²»ÊÇÒ»¸öеÄä¯ÀÀÆ÷´°¿Ú£¬¶øÊÇÏâǶÔÚÒ³ÃæÖеÄÒ»¸ö²ã¡£
1 ´´½¨Ò»¸ölinkbutton£¬ÓÃÓÚµã»÷´ò¿ª´°¿Ú¡£
2 ÍÏÈëÒ»¸öpanel£¬Õâ¸ö¾ÍÊÇÎÒÃÇÒªµ¯³öµÄ´°¿Ú¡£ËüÒ²¿ÉÒÔÊÇÁ½¸öǶÌ×µÄpanel¡£Àý³ÌÉÏÊÇÕâÑù×öµÄ£¬»¹ÊÇûÓÐÃ÷°×ΪʲôÕâô×ö¡£
3 ÍÏÈëÒ»¸öModalPopupExtender¿Ø¼þ£¬ÔڸÿؼþµÄta ......
´ó¼ÒÔÚ·ÃÎÊ google»ò°Ù¶ÈµÄʱºò£¬¼ÙÈçÒªËÑË÷“°¢·²´ï”£¬ÎÒÃÇ¿ÉÄÜÖ»ÐèÒªÊäÈëÒ»¸ö “°¢”×Ö£¬ÍøÕ¾¾Í»á×Ô¶¯Æ¥ÅäһЩ´Ê×鹩ÎÒÃÇÑ¡Ôñ£¬Õâ¸öÉè¼Æ·Ç³£ÈËÐÔ»¯¡£½ñÌìÎÒÃǾʹ˼¼Êõ¼òÒª½éÉÜ£¬±¾ÎļÙÉè¶ÁÕß²»Çå³þajax¼¼Êõϸ½Ú¡£
ÏÈ˵˵AJAX£¬ÎÒ֮ǰҲûÓйØ×¢¹ýÕâ·½Ã棬ÉÔ΢Á˽âÁËһϣ¬ÆäʵËü¾ÍÊÇÒ»¸ö¿Í»§ ......