AjaxÓ¦ÓõÄÎå¸ö²½Öè
//AjaxÓ¦ÓõÄÎå¸ö²½Öè
//1.´´½¨XMLHttpRequest¶ÔÏó
var xmlHttp=createXMLHttpRequest();
function createXMLHttpRequest()
{
var xmlHttp;
if(Window.XMLHttpRequest)
{
//IE6ÒÔÉÏ°æ±¾ºÍÆäËûä¯ÀÀÆ÷ÄÚÖÃXMLHttpRequest¶ÔÏó
xmlHttp=new XMLHttpRequest();
}
else if(Window.ActiveXObject)
{
//ÔÚIE6¼°ÆäÒÔÏÂä¯ÀÀÆ÷¿ÉÒÔͨ¹ýActiveXObjectµÄÁ½¸ö¿Ø¼þÀ´´´½¨£¬½«°æ±¾ÐµķÅÔÚÇ°Ãæ
var activexName=["MSXML2.XMLHTTP", "Microsoft.XMLHTTP"];
for(var i=0; i<activexName.length; i++)
{
try
{ //È¡³öÒ»¸ö¿Ø¼þÃû½øÐд´½¨£¬´´½¨³É¹¦¾ÍÖÕֹѻ·
xmlHttp=new ActiveXObject(activexName[i]);
break;
}
catch(e){};
}
}
//È·ÈÏXMLHttpRequest¶ÔÏó´´½¨³É¹¦
if(!xmlHttp)
{
alert("XMLHttpRequest¶ÔÏó´´½¨Ê§°Ü£¡");
return;
}
else
{
//alert(xmlHttp);
return xmlHttp;
}
}
//2.×¢²á»Øµ÷º¯Êý
xmlHttp.onreadystatechange=callback;
//3.³õʼ»¯XMLHttpRequest¶ÔÏó£¬ÉèÖÃÁ¬½ÓÐÅÏ¢
//µÚÒ»¸ö²ÎÊý±íʾhttpµÄÇëÇó·½Ê½£¬·ÖΪGETºÍPOSTÁ½ÖÖ£¬GET·½Ê½ÇëÇóµÄ²ÎÊýÔÚURLÖÐ
//µÚ¶þ¸ö²ÎÊý±íʾÇëÇóµÄurlµØÖ·£¬¸ÃµØÖ·»á±»½âÎöΪ¾ø¶ÔµØÖ·
//µÚÈý¸ö²ÎÊý±íʾÇëÇó·½Ê½ÊÇͬ²½»òÊÇÒì²½£¬Ä¬ÈÏÊÇͬ²½true£¬µÚËÄ£¬Îå¸ö²ÎÊýͨ³£²»ÓÃ
xmlHttp.open("GET",url, true);
//4.·¢ËÍÊý¾Ý£¬¿ªÊ¼ºÍ·þÎñÆ÷¶Ë½øÐн»¸¶
//ͬ²½·½Ê½Ï£ºsend()Õâ¾ä»°»áÔÚ·þÎñÆ÷¶ËµÄÊý¾Ý´«ËÍ»ØÀ´ºó²ÅÖ´ÐÐÍ꣬ÔÙÖ´ÐÐÏÂÒ»ÌõÓï¾ä
//Òì²½·½Ê½Ï£ºsend()Õâ¾ä»°»áÁ¢¼´Ö´ÐÐÍ꣬½Ó×ÅÖ´ÐÐÏÂÒ»ÌõÓï¾ä
//ÈôÒÔPOST·½Ê½,ÐèÒª×Ô¼ºÉèÖÃhttpµÄÇëÇóÍ·
//xmlHttp.open("POST",url,true);
//xmlHttp.setRequestHeader("Content-Type","application/x-www-form-urlencoded");
//xmlHttp.send("name="+value);
xmlHttp.send(null); //¸Ã²ÎÊýΪ¿ÉÑ¡£¬´ËʱҲ¿É²»Ð´
//5.¶¨Òå»Øµ÷º¯Êý£¬¸Ãº¯ÊýÖ÷Òª¸ºÔð½ÓÊÕ´Ó·þÎñÆ÷¶Ë´«»ØÀ´µÄÊý¾Ý£¬²¢ÔÚÒ³ÃæÉÏÏÔʾ
function callback()
{
//Åж϶ÔÏóµÄ½»»¥×´Ì¬Ê
Ïà¹ØÎĵµ£º
jqueryÖÐÓÃajax(òËƱàÂëĬÈÏΪutf-8)Èç¹ûÓÐÖÐÎĵĻ° »á³öÏÖÂÒÂë ÏÂÃæµÄ½â¾ö°ì·¨Ö®Ò»£º
ÒÔÏÂÊÇjsÖеĴúÂë
classname=encodeURI($('#classname').val());
classdescription=encodeURI($('#classdescription').val());
actionArr={classname:classname,classdescription:classdescription};
$.post("product_class ......
//==================>¡¾index.jsp¡¿===============================
<%@page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<% String path=request.getContextPath(); %>
<%@page import="com.sinoest.dfrf.orm.pojo.Mainmenu"%>
<%@page import="com.si ......
Dojo1.3.x
µÄ
Ajax
ʾÀý
ÕûÀíÈË£º»Æ³Ï
QQ
Ⱥ£º
65643887
ÕâƪÎÄÕÂÖ÷ÒªÊÇ°ïÖú¶Ô
Dojo
¸ÐÐËȤµÄÅóÓÑÃÇ¿ì
ËÙʵÏÖÍøÕ¾ÉϵÄÀý×Ó¡£
http://sitepen.com/labs/guides/?guide=DojoQuickStart#Ajax
Ëü½Ì³Ì·ÖÁË
3
²¿·Ö£¬ÆäÖеÄÀý×Ó²»ÈÝÒ×
ÉÏÊÖ¡£ÎÒÕâÀïÌṩһ¸ö´ò°üÎļþ
AjaxWithDojo.war
ÏÂÃæÎÒ½«Ïêϸ˵Ã÷²Ù×÷²½Ö ......
Ò».ÕªÒª
±¾ÏµÁÐÎÄÕ½«´øÄú½øÈëjQueryµÄ¾«²ÊÊÀ½ç, ÆäÖÐÓкܶà×÷Õß¾ßÌåµÄʹÓþÑéºÍ½â¾ö·½°¸,
¼´Ê¹Äã»áʹÓÃjQueryÒ²ÄÜÔÚÔĶÁÖз¢ÏÖЩÐíÃؼ®.
±¾ÆªÎÄÕ½²½âÈçºÎʹÓÃjQuery·½±ã¿ì½ÝµÄʵÏÖAjax¹¦ÄÜ.ͳһËùÓпª·¢ÈËÔ±
ʹÓÃAjaxµÄ·½Ê½.
¶þ.Ç°ÑÔ
AjaxÈÃÓû§Ò³Ãæ·á¸»ÆðÀ´, ÔöÇ¿ÁËÓû§ÌåÑé.
ʹÓÃAjaxÊÇËùÓÐWeb¿ª·¢µÄ±Ø ......
1¡¢µ±¸Ä±ä·þÎñÆ÷ÉϵÄ״̬ʱӦµ±Ê¹ÓÃPOST·½·¨¡£²»Í¬ÓÚGET£¬ÐèÒªÉèÖÃXML- HttpRequest¶ÔÏóµÄContent-TypeÊײ¿£¬ÈçÏÂËùʾ£º
xmlHttp.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
ÓëGET²»Í¬£¬POST²»»áÏÞÖÆ·¢Ë͸ø·þÎñÆ÷µÄ¾»ºÉµÄ´óС£¬¶øÇÒPOSTÇëÇó²»Äܱ£Ö¤ÊÇÃݵȵġ£
Äã×öµÄ´ó¶àÊýÇëÇó¿ÉÄܶ¼ÊÇG ......