ajaxµÄÏÂÀ¿òÁª¶¯
<html>
<body>
<script¡¡language="JavaScript">
¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡var¡¡req¡¡=¡¡null;
¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡function¡¡test()¡¡{
¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡var¡¡province¡¡=¡¡document.all("province").value;
¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡req¡¡=¡¡new¡¡ActiveXObject("Microsoft.XMLHTTP");
¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡//ÉèÖÃÊôÐÔ£¬µ±ºǫ́´¦ÀíÍê³Éºó£¬»ØÀ´µ÷ÓÃmyDeal·½·¨¡£
¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡req.onreadystatechange¡¡=¡¡myDeal;
¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡//·¢³öÇëÇó
¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡req.open("GET",¡¡"c.jsp?province="¡¡+¡¡province,¡¡"false");
¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡req.send(null);
¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡}
¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡function¡¡myDeal()¡¡{
¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡if¡¡(req.readyState¡¡==¡¡4)¡¡{
¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡//½ÓÊÕ·þÎñ¶Ë·µ»ØµÄÊý¾Ý
¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡var¡¡ret¡¡=¡¡req.responseText;
¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡//´¦ÀíÊý¾Ý
¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡var¡¡obj¡¡=¡¡document.all("city");
¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡for¡¡(var¡¡i¡¡=¡¡obj.options.length¡¡-¡¡1;¡¡i¡¡>=¡¡0;¡¡i--)¡¡{
¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡obj.options.remove(i);¡¡//´ÓºóÍùǰɾ³ý
¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡}
¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡var¡¡ops¡¡=¡¡ret.split("|");
¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡for¡¡(var¡¡i¡¡=¡¡0;¡¡i¡¡<¡¡ops.length;¡¡i++)¡¡{
¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡var¡¡op¡¡=¡¡ops[i];
¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡var¡¡ss¡¡=¡¡op.split(",");
¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡var¡¡oOption¡¡=¡¡document.createElement("OPTION");¡¡//´´½¨Ò»¸öOPTION½Úµã
¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡obj.options.add(oOption);¡¡¡¡¡¡¡¡//½«½Úµã¼ÓÈëcityÑ¡ÏîÖÐ
¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡
Ïà¹ØÎĵµ£º
What is AJAX
This section is for those who have no idea what AJAX is. If you don’t fall into this category, feel free to skip to the next section.
AJAX stands for asynchronous JavaScript and XML. If you see another term XHR, which is shorthand for XML HTTP request, it’s the same thing. ......
Ajax ÓÉ HTML¡¢JavaScript™ ¼¼Êõ¡¢DHTML ºÍ DOM ×é³É£¬ÕâÒ»½Ü³öµÄ·½·¨¿ÉÒÔ½«±¿×¾µÄ Web ½çÃæת»¯³É½»»¥Ð﵀ Ajax Ó¦ÓóÌÐò¡£±¾ÎĵÄ×÷ÕßÊÇһλ Ajax ר¼Ò£¬ËûÑÝʾÁËÕâЩ¼¼ÊõÈçºÎÐͬ¹¤×÷ —— ´Ó×ÜÌå¸ÅÊöµ½Ï¸½ÚµÄÌÖÂÛ —— ʹ¸ßЧµÄ Web ¿ª·¢³ÉΪÏÖʵ¡£Ëû»¹½Ò¿ªÁË Ajax ºËÐĸÅÄîµÄÉñÃØÃæÉ´£¬°üÀ¨ ......
¶àÊý Web Ó¦ÓóÌÐò¶¼Ê¹ÓÃÇëÇó/ÏìӦģÐÍ´Ó·þÎñÆ÷ÉÏ»ñµÃÍêÕûµÄ HTML Ò³Ãæ¡£³£³£Êǵã»÷Ò»¸ö°´Å¥£¬µÈ´ý·þÎñÆ÷ÏìÓ¦£¬ÔÙµã»÷ÁíÒ»¸ö°´Å¥£¬È»ºóÔٵȴý£¬ÕâÑùÒ»¸ö·´¸´µÄ¹ý³Ì¡£ÓÐÁË Ajax ºÍ XMLHttpRequest ¶ÔÏ󣬾ͿÉÒÔʹÓò»±ØÈÃÓû§µÈ´ý·þÎñÆ÷ÏìÓ¦µÄÇëÇó/ÏìӦģÐÍÁË¡£±¾ÎÄÖУ¬Brett McLaughlin ½éÉÜÁËÈçºÎ´´½¨Äܹ»ÊÊÓ¦²»Í¬ä¯ÀÀÆ÷µÄ ......
Java´úÂë
@Override
protected ModelAndView onSubmit(HttpServletRequest request, HttpServletResponse response, Object cmd,
BindException ex) {
&nb ......
<mce:script type="text/javascript" language="javascript"><!--
var http_request = false;
function makePOSTRequest(url, parameters) {
http_request = false;
if (window.XMLHttpRequest) { // Mozilla, Safari,...
http_request = new XMLHttpRequest();
if (ht ......