ʹÓÃjQueryʵÏÖAjaxÒì²½Ìá½»±íµ¥ÊµÏÖ¾Ö²¿Ë¢ÐÂ
jQueryѧϰ±Ê¼Ç
Ìá½»form±íµ¥Ö®ºó£¬²»»áË¢ÐÂÒ³Ã棬¶øÊǾֲ¿Ë¢Ð£¬ÓûÌá½»µÄformÖ»ÒªÓÐid¼´¿É
Èç¹ûʹÓÃgetÇëÇó£¬×¢ÒâÖÐÎÄÂÒÂëÎÊÌ⣬jquery»áÏÈʹÓÃiso8859-1½âÂ룬Ȼºó·¢¸ø·þÎñÆ÷£¬Èç¹ûʹÓÃpostÇëÇó£¬ÔòÖ±½Ó½«ÖÐÎÄÄÚÈÝÌá½»¸ø·þÎñÆ÷½âÎö¡£
ʹÓÃjquery-1.4.2.jsºÍjquery.form.js²å¼þ¡£
Èç¹û´´½¨ÐµÄjsÎļþÖУ¬ÐèÒª¼ÓÉÏ
document.write("<script type='text/javascript' src='jquery-1.4.2.js'></script>")
document.write("<script type='text/javascript' src='jquery.form.js'></script>")
// ¶¯Ì¬¼ÓÔØÒ³Ãæ
// id ÏÔʾҳÃæµÄÈÝÆ÷×é¼þID2
// url Óû¼ÓÔØÒ³ÃæÍøÖ·
// gop getÇëÇó»¹ÊÇpostÇëÇó£¬Ä¬ÈÏget
function loadPage(id, url, gop) {
$("#" + id).addClass("loader");
$("#" + id).append("Loading......");
var type = (gop == "post" ? "post" : "get");
$.ajax( {
type : type,
url : url,
cache : false,
error : function() {
alert('¼ÓÔØÒ³Ãæ' + url + 'ʱ³ö´í£¡')
},
success : function(content) {
$("#" + id).empty().append(content);
$("#" + id).removeClass("loader");
}
});
}
// ¾Ö²¿Ìá½»±íµ¥
function formSubmit(formId, divId, url) {
$('#' + formId).submit(function() {
$(this).ajaxSubmit( {
target : '#' + divId,
url : url,
error : function() {
alert('¼ÓÔØÒ³Ãæ' + url + 'ʱ³ö´í£¡')
}
});
return false;
});
}
Ïà¹ØÎĵµ£º
<script language="javascript" type="text/javascript">
¡¡¡¡function doubleSalary()
¡¡¡¡{
¡¡¡¡var employee = new Object();
¡¡¡¡employee.FirstName = "X";
¡¡¡¡employee.LastName = "PP";
¡¡¡¡employee.Salary = 1000;
......
<input type="button" onclick="ajaxTest()" value="AJAX²âÊÔ">
<input type="button" onclick=" document.getElementById('weather').innerHTML='' " value="Òþ²Ø">
<mce:script type="text/javascript"><!--
// 1. ³õʼ»¯ ÇëÇó ¶ÔÏó
// Mozilla/Firefox 쵀
//var xmlhttp = ne ......
ÓõıêÇ©ÓÐScriptManager£¬UpdatePanel£¬UpdateProgress £¬Ö÷ÒªµÄÊÇUpdatePanelÖеÄTriggersÊôÐÔÒ»¶¨Òª¶Ô¡£
ǰ̨´úÂë
<form id="form1" runat="server">
<div>
<asp:ScriptManager ID="ScriptManager1" runat="server">
</asp:ScriptManager>
<asp:UpdateP ......
web2.0ºá¿Õ³öÊÀ£¬ajaxÊ×µ±Æä³å£¬½ñÌì×öwebµÄÈç¹ûÔÙ²»Ñ§µãajaxµÄ»°£¬¾ÍÏÔµÄÂäÎéÁË£¬¶øѧajaxµÄÓõĻ·¾³Èç¹ûÊÇasp.net£¬ÄÇajax.netÄã¾Í²»µÃ²»Ñ§ÁË¡£Ê×ÏȾÍÊÇ»·¾³µÄÅäÖã¬ÈçÏÂ
vs2005+sql2005+Winxp sp2+ie6.0+Office2003»·¾³ÉèÖÃÈçÏ£º
ÏÂÔØÍê ASPAJAXExtSetup.msi °²×°¸üкóÔÚÄãµÄϵͳÅÌϵģ¨ÒÔCÅÌΪÀý£© ³öÏÖÕâ¸ö Îļ ......