AjaX ¶þ¼¶Áª¶¯
JSP:
¿Î³ÌÃû³Æ:
<script type="text/javascript" src="js/jquery.js"></script>
<script type="text/javascript" src="js/options.js"></script>
<html:select property="icourseId" onchange="change(this)" style="width:180px;">
<html:option value="0">----ÇëÑ¡ÔñÒÔÏ¿γÌ----</html:option>
<html:options collection="clist" labelProperty="ccourseName" property="icourseId"></html:options>
</html:select>
¿Î³ÌÕ½Ú:
<select name="ichapterId" id="result" style="width:180px;">
<option value="">----ÇëÑ¡ÔñÒÔÏÂÕ½Ú----</option>
</select>
******************************************************************************
options.js:
function change(option){
var opvalue = option.value;
//ÉèÖÃÓë·þÎñ¶Ë½øÐн»»¥µÄURL(°üÀ¨ÖÐÎÄ´¦Àí)
var url = "options.do?opvalue="+encodeURI(encodeURI(opvalue));
url = covertURL(url);
//Óë·þÎñ¶Ë½øÐн»»¥,²¢ÏÔʾÊý¾Ý
$.get(url,null,function(data){$("#result").html(data);});
}
//´¦Àí»º´æÎÊÌâ
function covertURL(url){
var timeURL = (new Date()).valueOf();
if(url.indexOf("?") >= 0){
url = url + "&t=" + timeURL;
}else{
url = url + "?t=" + timeURL;
}
return url;
}
***************************************************************************
ACTION:
public class OptionsAction extends Action {
private WebService webservice;
public void setWebservice(WebService webservice) {
this.webservice = webservice;
}
public ActionForward execute(ActionMapping mapping, ActionForm form,
HttpServletRequest request, HttpServletResponse response
Ïà¹ØÎĵµ£º
<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
<title></title>
<mce:style type="text/css"><!--
.n{TEXT-DECORATION:none;cursor:pointer} a{color:black} a:hover{color:blue}
.m{TEXT-DECORATION:none;c ......
function CreateXmlHttp()
{
if(window.ActiveXObject)
{
try
{
XmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
}
catch(e){};
try
{
XmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
}
catch(e){};
}
else if(window.XMLHt ......
asp.net ajaxѧϰ±Ê¼Ç
Ò»¡¢ µÇÌÃÈëÊÒ——»ù±¾¸ÅÄî
http://blog.csdn.net/soldierluo/archive/2009/11/18/4830758.aspx
¶þ¡¢ СÊÔÉíÊÖ——µÚÒ»¸öAjax³ÌÐò
http://bl ......
Ò»¡¢ н¨Ò»¸öAjax_StartµÄÍøÕ¾
¶þ¡¢ ÔÚÍøÕ¾ÖÐÌí¼ÓÒ»¸öweb·þÎñ£¨ws_start.asmx£©
ÔÚvs2008ÖУ¬Ìí¼ÓÒ»¸öweb·þÎñÉú³ÉÁËÁ½¸öÎļþ£¬Ò»¸öÊÇasmxÎļþ£¬Ò»¸öÊÇÔÚApp_codeÀïµÄcsÎļþ£»ÎÒ¾õµÃÕâÑù²¢²»ºÃ£¬Ö ......
var xmlhttp;
function verify()
{
//2.´´½¨XmlHttpRequest¶ÔÏó
//ÕâÊÇXmlHttpRequest¶ÔÏóÎå²½ÖÐʹÓÃ×ÔÓµÄÒ»²½
//ÐèÒªÕë¶ÔIEºÍÆäËûÀàÐ͵Ää¯ÀÀÆ÷½¨Á¢Õâ¸ö¶ÔÏóµÄ²»Í¬·½Ê½Ð´²»Í¬µÄ´úÂë
if(window.XMLHttpRequest)
{
......