·â×°Ò»¸ö¼òµ¥µÄAjaxº¯Êý
/**
* Ajax²Ù×÷º¯Êý
*
* @param url -- ·þÎñÆ÷¶ËÒ³ÃæµØÖ·
* @param param -- ²ÎÊý£¬ÀàËÆ 'user=123&id=100'
* @param method -- ÇëÇó·þÎñÆ÷¶ËµÄ·½·¨,GetºÍPostÁ½ÖÖ£¬Ä¬ÈÏÊÇGET
* @param response -- ÊÇ·ñ»ñÈ¡·þÎñÆ÷¶Ë·µ»ØµÄ½á¹û£¬Ä¬ÈÏÊÇtrue
*/
function ajax( url, param, method, response ){
//set default value
param = typeof(param)=='undefined' ? '' : param;
method = typeof(method)=='undefined' ? 'GET' : method;
response = typeof(response)=='undefined' ? true : response;
//get ajax object
var ajax = null;
try {
ajax = new ActiveXObject("Msxml2.XMLHTTP");
} catch (e) {
try {
ajax = new ActiveXObject("Microsoft.XMLHTTP");
} catch (E) {
ajax = null;
}
}
if (!ajax && typeof XMLHttpRequest!='undefined'){
ajax = new XMLHttpRequest();
}
if (!ajax){
alert("Get ajax object failed");
return false;
}
//send http request
var res = '';
if (method != 'GET'){
method = 'POST';
}
if (method == 'GET'){
ajax.open('GET', url + param, true);
ajax.onreadystatechange = function(){
if (ajax.readyState==4 && ajax.status==200){
res = ajax.responseText;
}
}
ajax.send(null);
}
if (method == "POST"){
ajax.open("POST", url, true);
ajax.setRequestHeader("Content-Type","application/x-www-form-urlencoded");
ajax.send(param);
ajax.onreadystatechange = function() {
if (ajax.readyState==4 && ajax.status==200) {
res = ajax.responseText;
}
}
}
if (response){
return res;
}
return null;
}
Ïà¹ØÎĵµ£º
Ò»¡¢ajaxµÄÈëÃÅ
1¡¢XMLHttpRequest¶ÔÏóµÄʹÓã¨Ê¹ÓÃXMLHttpRequest½âÎöxmlÎļþ£©
onreadystatechange
Ö¸¶¨µ±readyStateÊôÐԸıäʱµÄʼþ´¦Àí¾ä±ú
open()
´´½¨Ò»¸öеÄhttpÇëÇ󣬲¢Ö¸¶¨´ËÇëÇóµÄ·½·¨¡¢URLµÈÐÅÏ¢
send()
·¢ËÍÇëÇóµ½http·þÎñÆ÷²¢½ÓÊÕ»ØÓ¦
& ......
<style type="text/css">
<!--
.STYLE1 {
font-size: 24px;
font-weight: bold;
}
.STYLE2 {font-size: 36px}
-->
.mouseOut {
color: #000000;
}
.mouseOver {
&nb ......
£¨ÒÔÏÂÀ´×ÔWIKI£©
AJAXÈ«³ÆΪ“Asynchronous JavaScript and XML”£¨Òì²½JavaScriptºÍXML£©£¬ÊÇÒ»ÖÖ´´½¨½»»¥Ê½ÍøÒ³Ó¦ÓõÄÍøÒ³¿ª·¢¼¼Êõ¡£¸ù據AjaxÌá³öÕßJesse James Garrett½¨議[1]£¬Ëü£º
ʹÓÃXHTML+CSSÀ´±íʾÐÅÏ¢£»
ʹÓÃJavaScript²Ù×÷DOM£¨Document Object Model£©½øÐ ......
+++++++++++++++++++++++Ajax
~~~~~~~~~~~~~~~~~~~~~~~~~~
======= Ajax ¼¼Êõ ========
Ò»¡¢µÚÒ»¿Î ===¡· AJAX¸ÅÊöÓëIntelliJ°²×°
a.Ajax¶Á·¨Æäʵ²»ÊÇÎÒÃǶÁµÄ'°¢¼Ù¿Í˹'£¬×¢Òâרҵ»¯¡£
b.ÍõÐË¿ýÀÏʦÏȽ²Êµ¼ùÔÙ½²ÀíÂÛ¡£
c.¿ª·¢¹¤¾ß²»ÔÙÊÇeclipseÁË£¬ÒòΪajaxÖ÷Ҫдjavascript
d ......
1.µ½http://ajaxcontroltoolkit.codeplex.com/Release/ProjectReleases.aspx?ReleaseId=33804
ÏÂÔØAJAX Control Toolkit - Binary
2.½âѹµ½C:\Program Files\Microsoft.NET\ADOMD.NET\90
3.visual studio н¨Ò»ÍøÕ¾£¬Ë«»÷default.aspx
4.´ò¿ª¹¤¾ßÏ䣬ÓÒ»÷н¨Ò»Ñ¡Ï£¬Ã÷ÃûΪAjax Control Toolkit
5.ÓÒ»÷Ajax Contr ......