ajax post Ìá½»´óÊý¾ÝÁ¿ - Web ¿ª·¢ / Ajax
RT!
ajax Ìá½»Êý¾Ýʱ£¬Êý¾ÝÁ¿ºÜ´ó ÓÚÊÇ ¾ÍÑ¡ÔñÁË POSTÌá½»¡£
JScript code:
xmlHttpRequest.send(message);
message¾ÍÊÇ ×éÖ¯ºÃµÄÊý¾Ý¡£
ÔÚ100ÌõµÄʱºò£¬java¶Ë¿ÉÒÔ ½ÓÊܵ½Êý¾Ý¡£
200Ìõ¾Í²»ÐÐÁË¡£
Çë´óϺÃÇ °ï°ïСµÜ£¡
ÆäËû´úÂëÄØ£¿
message
ÊÇ´ÓÒ»¸öÒ³ÃæTableÖеõ½µÄÊý¾Ý
¾ÍÏñÊÇ£ºid=001&name=zhangÕâÑùµÄ×Ö·û´®
¸ç¸çÎÒÊ×´ÎÔÚÕâÀï·¢Ìû£¬ËùÒÔ»¨Ê±¼ä¸øÄãддÕâ¸öûӪÑøµÄÎÊÌâ¡£ÄãÕâÎÊÌâ°´µÀÀíÀ´ËµÊDz»´æÔÚ¡£
´úÂ룺
<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>·¢ËÍ´ó×Ö·û´®×Ö·û´®</title>
</head>
<body>
<input type="button" value="Send" onclick="send();"/>
</body>
<script type="text/javascript">
var xmlHttp = null;
function createXMLHttpRequest(){
if(window.ActiveXObject){
xmlHttp = new ActiveXObject("Microsoft.XMLHTTP");
}else if(Window.XMLHttpRequest){
xmlHttp = new XMLHttpRequest();
Ïà¹ØÎÊ´ð£º
ÎÒÏÖÔÚÓÃstruts2¿ò¼ÜÖÐÐèҪʹÓÃajaxʵÏÖ¾Ö²¿Ë¢Ð£¬µ«ÊÇ´ÓÈÝÆ÷Àï·µ»ØµÄÖµ²»ÖªµÀÔõô´Óstruts.xmlÅäÖÃÎļþÀïÓ³Éäµ½jspÒ³ÃæÀÒÔÇ°servletÀïдout.orint("xxxxx")¾Í¿ÉÒԵõ½~£¬µ«ÊÇÏÖÔÚÓÃstruts¾Í²»ÖªµÀÔõô ......
ÎÒÔÚÒ»¸öhtmlÖÐдÈçÏ´úÂ룺
JScript code:
<html>
<head>
<script type="text/javascript" charset="utf-8"
src="script/jquery-1.3.2.min ......
ÔÚ±¾µØ²âÊÔʱ¿ÉÒԵġ£
ÉÏ´«µ½·þÎñÆ÷¾Í³öÏÖûÓÐȨÏÞÎÊÌâ¡£
ÍøÉÏËÑË÷˵²»Äܹ»¿çÓò£¬µ«ÊÇÎÒûÓпçÓò°¡£¡
¶¼ÊÇÔÚ·þÎñÆ÷ÉÏÃæÔõô»áÓпçÓòÄØ£¿
¸ÃÔõô½â¾ö£¿£¿£¿£¿£¿£¿
´úÂëÌù³öÀ´¡£¡£
function Ajax(url,parm,fu ......
jspÒ³Ã棺
<s:select list="deptMap" name="deptid" listKey="key" value="%{deptid}" listValue="value" headerKey="" headerValue="--Çë ......
ÎÒÓÃASP.NET AJAXΪºÎ¼¯³É²»ÁË£¬±ÈÈ磨ÎÒÓÃUPDATEPANLE¿Ø¼þÄÚǶһ¸öGRIDVIEW¿ÉÊÇÔÚÉú³É½â¾ö·½°¸Ê±±¨´íÁË£¬ÇëÎÊÄÄλǰ±²ÖªµÀÔõô»ØÊ¡£
°ï¶¥£¬´ÓÀ´Ã»ÓùýUPDATEPANLE
°ï¶¥£¬µÈ´ý»Ø´ð
±¨Ê²Ã´´íàÞ¡£
LZË ......