ajaxÁ¬¶¯ÏÂÀ²Ëµ¥
-------------------------jspÖеÄjs´úÂë--------------------
<script type="text/javascript">
function ajaxFunction(sort){
var xmlHttp;
try{
// Firefox, Opera 8.0+, Safari
xmlHttp=new XMLHttpRequest();
} catch (e)
{
// Internet Explorer
try{
xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
}catch (e)
{
try{
xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
}catch (e)
{
alert("ÄúµÄä¯ÀÀÆ÷²»Ö§³ÖAJAX£¡");
return false;
}
}
}
xmlHttp.onreadystatechange=function(){
if(xmlHttp.readyState==4){
document.getElementById("div_product").innerHTML=xmlHttp.responseText;
}
}
xmlHttp.open("POST","problemAction.do?action=showVersions",true);
xmlHttp.send(null);
}
</script
Ïà¹ØÎĵµ£º
3.4Àí½â¼Ì³Ð
Ò»£®»ùÓÚÔÐ͵ļ̳Уº
²½Ö裺
(1)ÔÚ×ÓÀ๹Ô캯ÊýÖе÷ÓûùÀ๹Ô캯Êý£¬´Ó¶ø¼Ì³Ð»ùÀàµÄÊôÐÔ¡£
(2)½«»ùÀàµÄÒ»¸öÐÂʵÀý¸³¸ø×ÓÀ࣬´Ó¶ø¼Ì³Ð»ùÀàµÄ·½·¨¡£
Samples.Cat=function()
{
Samples.Pet.call(this);
}
Sample ......
2.1Microsoft Ajax LibraryËÙÀÀ£º
Microsoft Ajax LibraryÊÇÒ»×é¿ÉÒÔä¯ÀÀÆ÷¶Ë¶ÀÁ¢ÔËÐеÄJavaScriptº¯Êý¿â£¬°üº¬ÍøÒ³ºËÐÄ·þÎñÒÔ¼°Ìṩä¯ÀÀÆ÷µÄXMLÔ¶³ÌÊý¾Ý´æÈ¡ÄÜÁ¦¡£
Ö§³ÖµÄä¯ÀÀÆ÷ÓУºIE¡¢Mozilla¡¢Firefox¡¢Apple Safari¡£
2.1.2ÔÚASP.NETÒ³ÃæÖÐÔö¼ÓAjaxÖ§³Ö
Ajax LibraryÊÇרΪAjax¹¦ÄÜÌṩµÄScript£¬ËüÊ ......
jqueryÖÐÓÃajax(Ã²ËÆ±àÂëĬÈÏΪutf-8)Èç¹ûÓÐÖÐÎĵϰ »á³öÏÖÂÒÂë ÏÂÃæµÄ½â¾ö°ì·¨Ö®Ò»£º
ÒÔÏÂÊÇjsÖеĴúÂë
classname=encodeURI($('#classname').val());
classdescription=encodeURI($('#classdescription').val());
actionArr={classname:classname,classdescription:classdescription};
$.post("product_class ......
Ajax ¸ø XMLHttpReq.onreadystatechange´«µÝ²ÎÊý
ͨ¹ý£º
xmlhttp.onreadystatechange= function(){xx(123)};
or
xmlhttp.onreadystatechange= new Function("xx(123)");
¾Í¿ÉÒÔÁË¡£
m=document.getElementsByName("text8");
v=m[i];
XMLHttpReq.onreadystatechange=function(){proce(v)};
---------------------- ......