Ajaxѧϰ±Ê¼Ç
1¡¢´´½¨
XMLHttpRequest
¶ÔÏóµÄÒ»¸öʵÀý
var xmlHttp;
function createXMLHttpRequest() {
if (window.ActiveXObject) {
xmlHttp = new ActiveXObject("Microsoft.XMLHTTP");
}
else if (window.XMLHttpRequest) {
xmlHttp = new XMLHttpRequest();
}
}
Ïà¹ØÎĵµ£º
×î½üÍøÉÏÌáµÄºÜ¶àµÄÒ»¸öиÅÄî¾ÍÊÇ AJAX ÁË, ÄÇô, AJAX ÊÇʲôÄØ? ÒÔÏÂÄÚÈÝÒýÓÃÍøÉÏ×ÊÁÏ:
AJAXÈ«³ÆΪ“Asynchronous JavaScript and XML”£¨Òì²½JavaScriptºÍXML£©£¬ÊÇÖ¸Ò»ÖÖ´´½¨½»»¥Ê½ÍøÒ³Ó¦ÓõÄÍøÒ³¿ª·¢¼¼Êõ¡£ËüÓлúµØ°üº¬ÁËÒÔϼ¸ÖÖ¼¼Êõ£º
Ajax£¨Asynchronous JavaScript + XML£©µÄ¶¨Òå
»ùÓÚ web±ê×¼£¨sta ......
jqueryÖÐÓÃajax(òËƱàÂëĬÈÏΪutf-8)Èç¹ûÓÐÖÐÎĵĻ° »á³öÏÖÂÒÂë ÏÂÃæµÄ½â¾ö°ì·¨Ö®Ò»£º
ÒÔÏÂÊÇjsÖеĴúÂë
classname=encodeURI($('#classname').val());
classdescription=encodeURI($('#classdescription').val());
actionArr={classname:classname,classdescription:classdescription};
$.post("product_class ......
ÏÖÔÚ¸Õ¸Õ¿´Ò»Ð©¹ØÓÚAjaxµÄһЩ֪ʶµã¡£°ÑËüдÏÂÀ´£¬×÷Ϊ֪ʶµÄ±¸Íü¼£¡
ÒÔÏ´¿Êô¸öÈËÀí½â£¡£¡£¡
1. Ajax·ÖΪҳÃ沿·Ö£¨Ç°¶Ë£©£¬ºÍºǫ́´¦Àí²¿·Ö£¨ºó¶Ë£¬servlet£©£»
2. Ò³Ã棺´´½¨XmlHttpRequest¶ÔÏ󣬲»Í¬µÄä¯ÀÀÆ÷£¬ËùÖ§³ÖµÄXmlHttpRequest¶ÔÏó²»Í¨£»
Ò³Ã棺½¨Á¢·¢ ......
var httpRequest = false;
var mesdivs = null
function sendRequest(url, mesdiv) {
mesdivs = mesdiv;
httpRequest = false;
if (window.XMLHttpRequest) {
httpRequest = new XMLHttpRequest();
......
Web¿ª·¢Õß²»»á×¢Òâµ½ÓÉ “AJAX(Asynchronous JavaScript And XML)”Ëù´øÀ´µÄ¼¤Çé¡£²»·ÑÁ¦Æø¾ÍÄÜ´´½¨ÏñGoogle SuggestÄÇÑùµÄÖÇÄÜÍøÕ¾»òÕßÏñGmailÄÇÑù»ùÓÚWebµÄÓ¦ÓóÌÐò£¬ÕâÔںܴó³Ì¶ÈÉÏÒª¹é¹¦ÓÚÕâÖÖ¼¼Êõ¡£È»¶ø£¬°éËæ×ÅAJAXÓ¦ÓóÌÐòµÄ·¢Õ¹£¬ÎÒÃÇ·¢ÏÖÁËËüµÄһЩ²»×ãÖ®´¦£¬ÎÒÃÇ·¢ÏÖËüµÄ°²È«Â©¶´Ò²ÔÚÖð½¥±ä´ó£¬¾ÍÏñÂý ......