AjaxÌØÐ§ ¸ù¾ÝÓÊÕþ±àÂë»ñÈ¡µØÇøÐÅÏ¢ Ö®Èý
Óû§²Ù×÷½çÃæpostalcode.html
Ò³ÃæÖаüº¬3¸öÎı¾¿ò£¬·Ö±ð±íʾÓÊÕþ±àÂë¡¢µØÇøºÍ³ÇÊÐÐÅÏ¢¡£µ±Óû§ÊäÈëÓÊÕþ±àÂëºó£¬ÏµÍ³½«×Ô¶¯´Ó·þÎñÆ÷¶ÁÈ¡µØÇøºÍ³ÇÊÐÐÅÏ¢£¬Ìî³äµ½¶ÔÓ¦Îı¾¿òÖС£ÏêϸµÄº¯Êý˵Ã÷Çë²Î¿¼´úÂëÖеÄ×¢ÊÍ¡£
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<head>
<title>¸ù¾ÝÓÊÕþ±àÂë»ñȡʡÊÐÐÅÏ¢</title>
<meta http-equiv="Content-type" content="text/html; charset=utf-8">
<script type="text/javascript">
var xmlHttp; //ÓÃÓÚ±£´æXMLHttpRequest¶ÔÏóµÄÈ«¾Ö±äÁ¿
//ÓÃÓÚ´´½¨XMLHttpRequest¶ÔÏó
function createXmlHttp() {
//¸ù¾Ýwindow.XMLHttpRequest¶ÔÏóÊÇ·ñ´æÔÚʹÓò»Í¬µÄ´´½¨·½Ê½
if (window.XMLHttpRequest) {
xmlHttp = new XMLHttpRequest(); //FireFox¡¢OperaµÈä¯ÀÀÆ÷Ö§³ÖµÄ´´½¨·½Ê½
} else {
xmlHttp = new ActiveXObject("Microsoft.XMLHTTP"); //IEä¯ÀÀÆ÷Ö§³ÖµÄ´´½¨·½Ê½
}
}
//½öÔÊÐíÊäÈëÊý×Ö
function checkNumber() {
//ÅжÏÊäÈë×Ö·ûµÄkeyCode£¬Êý×ÖÔÚ48~57Ö®¼ä£¬³¬³ö²¿·Ö·µ»Øfalse
if ((event.keyCode >= 48) && (event.keyCode <= 57)) {
event.returnValue = true;
} else {
event.returnValue = false;
}
}
//»ñÈ¡µØÇøÐÅÏ¢µÄµ÷Óú¯Êý
function getPostalCode() {
var pCodeValue = document.getElementById("postalCode").value; //»ñÈ¡ÊäÈëµÄÓÊÕþ±àÂë
//µ±ÊäÈëµÄÓʱ೤¶È¸ÕºÃµÈÓÚ6ʱ£¬ÀûÓÃXmlHttpRequest¶ÔÏóÏò·þÎñÆ÷·¢³öÒì²½ÇëÇó
if (pCodeValue.length
Ïà¹ØÎĵµ£º
ÕâÀïµÄajax¿É²»ÊÇ´óÃû¶¦¶¦µÄajax¾ãÀÖ²¿£¬ ÕâËĸö×ÖĸÔÚÕâÀïAsynchronous JavaScript and XMLµÄËõд¡£Í¨Ë×µØÃèÊöÕâÏî¼¼Êõ¾ÍÊÇ£ºÓà JavaScript Ïò·þÎñÆ÷»ñÈ¡Êý¾Ý£¬È»ºó¸üÐÂÍøÒ³µÄ¾Ö²¿£¬¶ø²»ÊÇË¢ÐÂÕû¸öÍøÒ³¡£
ÕâÏî¼¼Êõ·Ç³£ÊʺÏÓÃÀ´¿ª·¢ÒÔä¯ÀÀÆ÷Ϊ¿Í»§¶ËµÄϵͳµÄ½çÃæ£¬Ê¹ÓÃajax¸øÓû§´øÀ´µÄ¸üºÃµÄÌåÑ飬ËûÃDz»»á¸Ð¾õµ½ÓÃä¯À ......
½ñÌìÓÃajaxµÄpost·½Ê½´«ÖµÊ±£¬Óöµ½Ò»¸öÎÊÌ⣬ʼÖÕûÓÐÕÒµ½ÎÊÌâÔÒò¡£ºóÀ´°Ñ´«µÄÖµÖе¥ÒýºÅÈ¥µôºó£¬jsÕý³£ÁË¡£
¾¹ýËÑË÷£¬Ò²Ã»ÓÐÕÒµ½¾ßÌåÔÒò¡£×îºóͨ¹ýÒþ²ØÓòÀ´ÖÐת¸Ã×Ö·û´®¡£×îºó½â¾öÕâ¸öÎÊÌ⣡ÎÞÓïÁË£¡±¸Íü£¡
js²¿·Ý£º
////Òì²½µ÷Ó÷þÎñÆ÷ÐÅÏ¢
function CallServiceInsert()
{
var url="";
var para ......
AJAXÎÞÒÉÊÇ2005Äê³´µÄ×îÈȵÄWeb¿ª·¢¼¼ÊõÖ®Ò»£¬µ±È»£¬Õâ¸ö¹¦ÀÍÀë²»¿ªGoogle¡£ÎÒÖ»ÊÇÒ»¸öÆÕͨ¿ª·¢Õߣ¬Ê¹ÓÃAJAXµÄµØ·½²»ÊÇÌØ±ð¶à£¬ÎҾͼòµ¥µÄ°ÑÎÒʹÓõÄÐĵÃ˵һÏ¡££¨±¾ÎļÙÉèÓû§ÒѾ¾ßÓÐJavaScript¡¢HTML¡¢CSSµÈ»ù±¾µÄWeb¿ª·¢ÄÜÁ¦£©
¡¡¡¡[AJAX½éÉÜ]
¡¡¡¡AjaxÊÇʹÓÿͻ§¶Ë½Å±¾ÓëWeb·þÎñÆ÷½»»»Êý¾ÝµÄWebÓ¦Óÿª·¢·½·¨¡ ......
·þÎñÆ÷¶ËÏìÓ¦Îļþread_faq.jsp
·þÎñÆ÷ÏìÓ¦Îļþ¸ù¾ÝÓû§´«ÈëµÄfaqId²ÎÊý£¬´ÓÊý¾Ý¿âÖвéÕÒ¶ÔÓ¦µÄFAQÏêϸÐÅÏ¢¡£ÏêϸÐÅÏ¢¿ÉÒÔΪ°üº¬HTML±ê¼ÇµÄÄÚÈÝ¡£²éѯÍê±Ïºó½«½á¹û·µ»Ø¡£
<%@ page contentType="text/plain; charset=UTF-8"%>
<%@ page language="java"%>
<%@ page import="java.sql.*,ajax.db.D ......