AJAX ¿â API
ʲôÊÇ AJAX ¿â API£¿
AJAX ¿â API ÊÇÒ»ÖÖÄÚÈÝ·Ö²¼ÍøÂ磬¿ÉÔØÈë×îÊÜ»¶ÓµÄ¿ªÔ´ JavaScript ¿âµÄ¼Ü¹¹¡£Í¨¹ýʹÓà Google AJAX API ÔØÈë³ÌÐòµÄ google.load() ·½·¨£¬ÄúµÄÓ¦ÓóÌÐòÄܹ»Ñ¸ËÙ´ÓÈ«ÇòÈκÎλÖ÷ÃÎʲ»¶ÏÔö³¤µÄ¡¢×îÊÜ»¶ÓµÄ¿ªÔ´ JavaScript ¿âÁÐ±í£¬°üÀ¨£º
jQuery
jQuery UI
Prototype
script.aculo.us
MooTools
Dojo
SWFObject
Yahoo! Óû§½çÃæ¿â (YUI)
Google Ö±½ÓÓë¹Ø¼üÏà¹ØÈËÔ±ÅäºÏÀ´Î¬»¤Ã¿¸ö¿âµÄÀûÒ棬²¢ÔÚ×îÐÂÎȶ¨°æ±¾·¢²¼Ê±½ÓÊÜÕâЩ°æ±¾¡£Ò»µ©ÎÒÃÇÍйܸø¶¨¿âµÄ°æ±¾£¬ÎÒÃdzÐŵÎÞÏÞÆÚµØÍйܸð汾¡£
AJAX ¿â API ÔÚʹÓÿ⼯ºÏµÄͬʱÏû³ýÁËÓà JavaScript ¿ª·¢»ì´îµÄ²»±ãÖ®´¦¡£ÎÒÃÇÏû³ýÁËÍйܿâµÄ²»±ãÖ®´¦¡¢ÕýÈ·µØÉèÖûº´æ±êÍ·¡¢Óë×îдíÎóÐÞÕýÈÕÆÚ±£³ÖÒ»Öµȡ£
<script src="http://www.google.com/jsapi"></script>
<script>
// Load jQuery
google.load("jquery", "1");
// on page load complete, fire off a jQuery json-p query
// against Google web search
google.setOnLoadCallback(function() {
$.getJSON("http://ajax.googleapis.com/ajax/services/search/web?q=google&v=1.0&callback=?",
// on search completion, process the results
function (data) {
if (data.responseData.results &&
data.responseData.results.length > 0) {
var results = data.responseData.results;
for (var i=0; i < results.length; i++) {
// Display each result however you wish
alert(results[i].titleNoFormatting);
}
}
});
});
</script>
Ïà¹ØÎĵµ£º
Ò»¡¢XMLHttpRequest ¶ÔÏóµÄ·½·¨ÓëÊôÐÔ
·½ ·¨
Ãè Êö
abort()
Í£Ö¹µ±Ç°ÇëÇó
getAllResponseHeaders()
°ÑHTTPÇëÇóµÄËùÓÐÏìÓ¦Êײ¿×÷Ϊ¼ü/Öµ¶Ô·µ»Ø
getResponseHeader("header")
·µ»ØÖ¸¶¨Êײ¿µÄ´®Öµ
open("method", "url")
½¨Á¢¶Ô·þÎñÆ÷µÄµ÷Óá£method²ÎÊý¿ÉÒÔÊÇGET¡¢POST»òPUT¡£ ......
javascriptÑØÓÃjavaµÄ×Ö·û´¦Àí·½Ê½£¬ÄÚ²¿ÊÇʹÓÃunicodeÀ´´¦ÀíËùÓÐ×Ö·ûµÄ£¬
µÚ¶þ£¬utf-8ÊÇÿ¸öºº×Ö£¨unicode×Ö·û£©ÓÃ3¸ö×Ö½ÚÀ´´æ´¢¡£
µÚÈý£¬ÓÃutf-8À´sendÊý¾ÝÊDz»»á³öÏÖÂÒÂëµÄ£¬ÊǺǫ́³ÌÐòûÓÐÕýÈ·½âÂë²Å»á³öÏÖÂÒÂë¡£
µÚËÄ£¬ajax·¢ËÍÊý¾ÝµÄʱºòÈç¹ûÐÞ¸Ä Content-Type Ϊ application/x-www-form-urlencoded"£¬¿Ï¶ ......
[http://www.okajax.com/a/200905/10ajax_framework_2.html]
1. APS.NETµÄ¹Ù·½½â¾ö·½°¸
ASP.NET AJAX
꿅᣼ajax.asp.net
ASP.NET AJAXÊÇ΢Èí.NETƽ̨ÉϵĽâ¾ö·½°¸£¬Ìṩº¸ÇËÅ·þÆ÷¶ËÓëÓû§¶ËËùÐèµÄAJAX¼¼ÊõÓëJavaScriptÕûºÏ»úÖÆ¡£
͸¹ýÓëÏÂÔØÓë°²×°ASP.NET AJAXµ½Visual Studio 2005µ±ÖУ¬¼´¿ÉÀûÓÃÔ¤ÉèµÄ¿ØÖÆÏ¿ª· ......
<asp:UpdatePanel ID="UpdatePanel2" runat="server">
<ContentTemplate>
<asp:GridView ID="GvPubList" runat="server" AutoGenerateColumns="False"
......
º¯ÊýÊǽøÐÐÄ£¿é»¯³ÌÐòÉè¼ÆµÄ»ù´¡£¬±àд¸´ÔÓµÄAjaxÓ¦ÓóÌÐò£¬±ØÐë¶Ôº¯ÊýÓиüÉîÈëµÄÁ˽⡣JavaScriptÖеĺ¯Êý²»Í¬ÓÚÆäËûµÄÓïÑÔ£¬Ã¿¸öº¯Êý¶¼ÊÇ
×÷Ϊһ¸ö¶ÔÏó±»Î¬»¤ºÍÔËÐеġ£Í¨¹ýº¯Êý¶ÔÏóµÄÐÔÖÊ£¬¿ÉÒԺܷ½±ãµÄ½«Ò»¸öº¯Êý¸³Öµ¸øÒ»¸ö±äÁ¿»òÕß½«º¯Êý×÷Ϊ²ÎÊý´«µÝ¡£ÔÚ¼ÌÐø½²Êö֮ǰ£¬ÏÈ¿´Ò»Ïº¯ÊýµÄʹÓÃÓï
·¨£º
function func1(& ......