Ò׽ؽØͼÈí¼þ¡¢µ¥Îļþ¡¢Ãâ°²×°¡¢´¿ÂÌÉ«¡¢½ö160KB

ajaxѧϰ±Ê¼Ç1

<html>
<head>
<title></title>
</head>
<mce:script type="text/javascript"><!--
var xmlHttp = false;
try{
xmlHttp = new XMLHttpRequest();
}catch(trymicrosoft){
try{
xmlHttp = new ActiveXObject("Msxml2.XMLHTTP");
}catch(othermicrosoft){
try{
xmlHttp = new ActiveXObject("Microsoft.XMLHTTP");
}catch(failed){
xmlHttp = false;
}
}
}
if(xmlHttp == false){
alert("Error initializing XMLHttpRequest!");
}

// --></mce:script>
<mce:script type="text/javascript"><!--
function callServer(){
var city = document.getElementById("city");
if(city==null||city=="") return;
var url = "do_ajax.jsp?city="+escape(city);
xmlHttp.open("GET",url,true);
xmlHttp.onreadystatechange = updatePage;//onreadyStateChangeʼþÊÇÔÚreadyStateÊôÐÔ·¢Éú¸Ä±äʱ´¥·¢µÄ
xmlHttp.send(null);
}
function updatePage(){
if(xmlHttp.readyState == 4){
if(xmlHttp.status == 200){
var response = xmlHttp.responseText;
document.getElementById("zipCode").value=response;
}else if(xmlHttp.status == 404){
alert("not exsist");
}else {
alert("Error: status code is " + xmlHttp.status);
}
}

}

// --></mce:script>
<body>
<form action="">
city:<input type="text" id="city" onchange="callServer();">
<br>
zipCode:<input type="text" id="zipCode">
</form>
</body>
</html>
×ÊÁÏÀ´Ô´£ºhttp://www.ibm.com/developerworks/cn/ajax/newto.html?S_TACT=105AGX52&S_CMP=content 


Ïà¹ØÎĵµ£º

ajax ¶ÁÈ¡ .csv Îļþ

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="content-type" content="text/html;charset=utf-8">
<title>JavaScript Sample</title>
<link rel="stylesheet" type="text/css" href="main.css" media="all">
<sc ......

ajax ϵͳ´íÎó 1072896748

ÔÚʹÓÃJQueryµÄajax·ÃÎÊÒ³Ãæʱ£¬×ÜÊdzö´í£¬µÃ²»µ½·µ»ØµÄhtml´úÂ룬ÓÖ²»ÖªµÀ³öµÄʲô´í£¬°Ù˼²»µÃÆä½â
ÓÚÊǾÍÓÃXMLHTTPÈ¥·ÃÎÊ£¬½á¹ûÒ²³ö´í£¬²»¹ýÄܹ»µÃµ½´íÎóÔ­Òò£¬È»ºó¸ù¾Ý´íÎóÒòΪȥÍøÉϲ飬ÖÕÓڵõ½Á˴𰸡£¡£
Ô­À´jspµÄ±àÂëÓëjavaµÄ±àÂë²»Ò»ÖÂ
·½°¸¢Ù
 ´íÎó
<%@ page contentType="text/html;charset= ......

ÓÃAJAXµ÷ÓÃXMLʱ¾¹È»²»ÄÜ°üº¬ÈκηûºÅ

ÎÒÓÃActiveXObject("Microsoft.xmldom")À´×°ÔØxmlÎĵµÊ±£¬¾¹È»ÀÏÊÇÌáʾװÔØʧ°Ü£¬ºóÀ´ÉÏÍøËÑË÷ÁËÏ£¬ËµÊDz»ÄÜÖ±½Ó°üº¬Õâ5¸ö·ûºÅ£¨'><&"£©£¬±ØÐëÑ¡ÓÃ&xx;·½Ê½À´×ªÒ壬¿ÉÎÒÕÒ±éXMLҲû·¢ÏÖÕâЩ¡£
ºóÀ´ÎÒ¶ÀÐÐÅųý£¬²Å·¢ÏÖÓÐÒ»¸öÔªËصÄÊôÐÔֵΪÓГ|”£¬È¥³ýºó¾ÍÕý³£ÁË¡£ÎÒÕæÊǾõµÃÆæ¹Ö£¬ÍøÉÏҲûÓÐ˵ ......

±íµ¥ajaxÌá½»ÂÒÂëÎÊÌâ


ÎÊÌâ
ÔÚÏÖÓÐÖ÷Õ¾ÖÐʹÓõÄÊÇÊÇGBK±àÂëµÄ£¬µ±±íµ¥Ê¹ÓÃform submit·½Ê½µÝ½»µÄ»°Ã»ÓÐÎÊÌ⣬·þÎñÆ÷¶ËÄܹ»Õýȷʶ±ð×Ö·û±àÂë¡£µ«ÊÇ£¬µ±¿Í»§¶ËʹÓÃajaxµÄ·½Ê½µÝ½»±íµ¥µÄ»°£¬·þÎñÆ÷¶Ëʶ±ð¿Í»§¶ËµÝ½»µÄ±íµ¥µÄÄÚÈÝ£¬µ±ÄÚÈÝÖÐÓÐÖÐÎÄ×Ö·ûµÄ»°¾Í»á³öÏÖÂÒÂëÏÖÏó¡£
Ô­Òò·ÖÎö
¾¿ÆäÔ­Òò£¬ÆäʵºÜ¼òµ¥£¬Ê¹ÓÃajax·½Ê½Ìá½»µÄ±íµ¥ÊÇÓÃutf-8± ......

struts2 + jquery + json ½øÐÐajaxÇëÇó


ÏîÄ¿ÖÐÏëÓÃajax£¬ÓÚÊÇÔÚÍøÉÏ°ÇÁËn¶à×ÊÁÏ£¬·¸ÁËn¶à´íÎ󣬴ӽñÌìÉϰൽÏÖÔÚÒ»Ö±ÔÚ´¦ÀíÕâ¸öÎÊÌ⣬ÖÕÓÚ»¹ÊÇ°ÑËü½â¾öÁË¡£
 
µ±ÎÒ¿´µ½Ò³ÃæµÄajaxÏÔʾºó£¬ÎÒÐË·ÜÒì³££¬ÎªÁ˼Ǽ×Ô¼ºÑ§Ï°µÄajaxÀú³Ì£¬Ò²ÎªÁËÈøü¶àµÄÈËÉÙ×ßÍä·£¬ÌØд´ËÒ»ÎÄÒÔ¼ÇÖ®£¡
 
·Ï»°²»ËµÁË£¬ÎªÁ˸üºÃµÄÀí½â£¬ÎÒÖØ×öÁËÒ»¸öСµÄÏîÄ¿£¬ÒÔ¼ÓÉîÓ¡Ïó ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ