ajax Àý×Ó
<script type="text/javascript">
//¶¨ÒåXMLHttpRequest¶ÔÏó±äÁ¿
var xmlHttpRequest;
/*
* ´´½¨XMLHttpRequest¶ÔÏó¡£
* ±¾º¯ÊýÖ÷ÒªÍê³ÉXMLHttpRequest¶ÔÏóµÄ´´½¨£¬ºËÐÄ·ÖΪÒÔÏÂÁ½¸ö²¿·Ö£º
* µÚÒ»²½£ºÊ×ÏÈÅжÏä¯ÀÀÆ÷ÊÇ·ñ°ÑXMLHttpRequest¶ÔÏóʵÏÖΪ±¾µØJavaScript¶ÔÏó£¬Èç¹û´æÔÚwindow.XMLHttpRequest£¬ÄÇô¾Í´´½¨XMLHttpRequest¶ÔÏó¡£
* µÚ¶þ²½£ºÈç¹û²»´æÔÚwindow.XMLHttpRequest,ÄÇô¾Í³¢ÊÔÔÚMicrosoftä¯ÀÀÆ÷¶ÔÏóÖд´½¨¸Ã¶ÔÏó¡£ÔÚÕâ¸ö¹ý³ÌÖУ¬Ïȳ¢ÊÔʹÓÃMsxml2.XMLHTTP¶ÔÏó´´½¨Ëü£¬Èç¹ûʧ°Ü
* ¾ÍÓÃMicrosoft.XMLHTTP¶ÔÏó
*/
function createXMLHttpRequest(){
if(window.XMLHttpRequest){ //Mozillaä¯ÀÀÆ÷
xmlHttpRequest = new XMLHttpRequest();
}else if(window.ActiveXObject){ //IEä¯ÀÀÆ÷
try{
xmlHttpRequest = new ActiveXObject("Msxm12.XMLHTTP");
}catch(e){
try{
xmlHttpRequest = new ActiveXObject("Microsoft.XMLHTTP");
}catch(e){}
}
}
}
/*
* ·¢ËÍÇëÇó¡£Ö÷ÒªÓÐÒÔϼ¸²½×é³É£º
* µÚÒ»²½£º´´½¨XMLHttpRequest¶ÔÏó
* µÚ¶þ²½£ºÖ´ÐÐopen()·½·¨£¬´ò¿ª·þÎñÆ÷Á¬½Ó
* µÚÈý²½£ºÖ´Ðлص÷º¯Êý
* µÚËIJ½£ºÖ´ÐÐsend()·½·¨£¬·¢ËÍÇëÇó
*/
function sendRequest(username){
//´´½¨XMLHttpRequest¶ÔÏó
createXMLHttpRequest();
//Éú³ÉËæ»úº¯Êý£¬·ÀÖ¹µÚ¶þ´ÎÖ´ÐÐajaxʱ²»×ßaction
var random = Math.random();
//Ö¸¶¨ÇëÇó·¢Ë͵ÄurlµØÖ·ºÍ²ÎÊý
var url = "servlet/LoginServlet?username="+username+"&random="+random;
//´ò¿ª·þÎñÆ÷µÄÁ¬½Ó¡£µÚÒ»¸ö²ÎÊýÖ¸Ã÷HTTPÇëÇóʹÓõķ½·¨£»µÚ¶þ¸ö²ÎÊýÖ¸Ã÷
Ïà¹ØÎĵµ£º
[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µ±ÖУ¬¼´¿ÉÀûÓÃÔ¤ÉèµÄ¿ØÖÆÏ¿ª· ......
<script type="text/javascript">
function ajaxFunction()
{
var xmlHttp
;
try
{
// Firefox, Opera 8.0+, Safari
xmlHttp=new XMLHttpRequest();
}
catch (e)
{
// Internet Expl ......
dwrµÄReverse AjaxÇ°ÃæÒ»Ö±¶¼Ã»ÓÐÓùý£¬×î½üÒòΪÏîÄ¿ÀïÃæÉæ¼°µ½Ñо¿ÁËÏ£¬»¹ÊÇÁô¸ö¼Ç¼°É¡£
dwrµÄÄæÏòajaxÆäʵÖ÷Òª°üÀ¨Á½ÖÖģʽ£ºÖ÷¶¯Ä£Ê½ºÍ±»¶¯Ä£Ê½¡£ÆäÖÐÖ÷¶¯Ä£Ê½°üÀ¨PollingºÍCometÁ½ÖÖ£¬±»¶¯Ä£Ê½Ö»ÓÐPiggybackÕâÒ»ÖÖ¡£
ËùνµÄPiggybackÖ¸µÄÊÇÈç¹ûºǫ́ÓÐʲôÄÚÈÝÐèÒªÍÆË͵½Ç°Ì¨ ......
Ïò´ó¼ÒÍƼö10¸öÏ൱°ôµÄAjaxºÍJavascript¹úÍâ×ÊÔ´ÍøÕ¾»ò²©¿Í£¬ËüÃÇÌṩÁËÏ൱¶àµÄ¸ßÖÊÁ¿Ajax¡¢JavascriptʵÀý¼°½Ì³Ì£¬Ï²»¶AjaxºÍJavascriptµÄÅóÓѾø¶Ô²»ÄÜ´í¹ý¡£
1.Ajax Rain
AjaxRainÓкܶàÍêÃÀÕûºÏAJAX, CSS, DHTML »ò JavascriptµÄʵÀý£¬ÓÐһЩDemoµÄÈ·ÖµµÃÄãÈ¥¿´Ò»¿´£¬¼´Ê¹Äã²»ÊÇÍøÒ³Éè¼Æ(¿ª·¢)ʦ¡£
Ajax/Javascri ......
ʹÓÃAjaxÎÞË¢ÐÂÉÏ´«ÎļþÊǵ±Ç°±È½ÏÁ÷ÐеŦÄÜ¡£½èÖúJQueryÇ¿´óµÄ²å¼þ£¬ÏÖÔÚÒѾ¿ÉÒÔºÜÈÝÒ×ÁË¡£
Ê×Ïȵ¼ÈëjsÎļþjquery.ajaxfileupload.js¡£´Ë²å¼þµÄÔÀíÊÇÔÚÎĵµÖд´½¨iframeºÍformÈ»ºóÔÚ½«ÎļþÉÏ´«µ½·þÎñÆ÷¡£
1 <html xmlns="http://www.w3.org/1999/xhtml">
2 <head id="Head ......