AjaxÅжÏä¯ÀÀÆ÷µÄ·½·¨×ܽá
Ê×ÏÈ°Ñ´úÂë¸ø´ó¼Ò£¬ÏÂÃæÊǽâÊÍ
/**
* »ñµÃXMLHttpRequest¶ÔÏó
*/
function createXHR(){
var x=[function(){return new ActiveXObject("Msxm12.XMLHTTP");},function(){return xmhttp=new ActiveXObject("Microsoft.XMLHTTP");},
function(){return new XMLHttpRequest();}];
for (var i=0; i<x.length; i++) {
try {
return (x[i])();
} catch (e) {
}
};
}
·½·¨Ò»:
//´´½¨Ò»¸ö²¼¶ûÐͱäÁ¿,ÓÃÀ´¼ì²éÊÇ·ñΪºÏ·¨µÄIEʵÀý
var xmlreq = false;
//¼ì²éÊÇ·ñʹÓõÄÊÇIE
try {
//Èç¹ûJavaScriptµÄ°æ±¾´óÓÚ5
xmlreq = new ActiveXObject("Msxml2.XMLHTTP");
} catch (e1) {
// Èç¹û²»ÊÇ,ÔòʹÓÃÀÏ°æ±¾µÄActiveX¶ÔÏóÀ´¼ì²é
try {
//Èç¹ûʹÓõÄÊÇIEä¯ÀÀÆ÷
xmlreq = new ActiveXObject("Microsoft.XMLHTTP");
} catch (e2) {
// ·ñÔò¿Ï¶¨Ê¹ÓõÄÊÇ·ÇIEä¯ÀÀÆ÷
xmlreq=false;
}
}
}
//Èç¹ûʹÓõÄÊÇ·ÇIEä¯ÀÀÆ÷,Ôò´´½¨Ò»¸ö¸Ã¶ÔÏóµÄJavaSriptʵÀý
if(!xmlreq && typeof XMLHttpRequest!='undefined'){
xmlreq=new XMLHttpRequest();
}
·½·¨¶þ:
//´´½¨Ò»¸ö²¼¶ûÐͱäÁ¿,ÓÃÀ´¼ì²éÊÇ·ñΪºÏ·¨µÄIEʵÀý
var xmlreq = false;
//Èç¹ûActiveX¶ÔÏó¿ÉÓÃ,ÔòʹÓõĿ϶¨ÊÇIE
if (window.ActiveXObject) {
xmlreq = new ActiveXObject("Microsoft.XMLHTTP");
} else {
// ·ñÔò¿Ï¶¨Ê¹ÓÃJavaSript´¦Àí·½·¨
xmlreq=new XMLHttpRequest();
}
·½·¨Èý:
//´´½¨Ò»¸ö²¼¶ûÐͱäÁ¿,ÓÃÀ´¼ì²éÊÇ·ñΪºÏ·¨µÄIEʵÀý
var xmlreq = false;
//
if (window.XMLHttpRequest) {
// Èç¹ûʹÓõÄÊÇ·ÇIEä¯ÀÀÆ÷,Ôò´´½¨Ò»¸ö¸Ã¶ÔÏóµÄJavaSriptʵÀý
xmlreq = new XMLHttpRequest();
} else if (window.ActiveXObject) {
// Create XMLHttpRequest via MS ActiveX
try {
// Èç¹ûJavaScriptµÄ°æ±¾´óÓÚ5
xmlreq = new ActiveXObject("Msxml2.XMLHTTP");
} catch (e1) {
Ïà¹ØÎĵµ£º
What is AJAX
This section is for those who have no idea what AJAX is. If you don’t fall into this category, feel free to skip to the next section.
AJAX stands for asynchronous JavaScript and XML. If you see another term XHR, which is shorthand for XML HTTP request, it’s the same thing. ......
¶àÊý Web Ó¦ÓóÌÐò¶¼Ê¹ÓÃÇëÇó/ÏìӦģÐÍ´Ó·þÎñÆ÷ÉÏ»ñµÃÍêÕûµÄ HTML Ò³Ãæ¡£³£³£Êǵã»÷Ò»¸ö°´Å¥£¬µÈ´ý·þÎñÆ÷ÏìÓ¦£¬ÔÙµã»÷ÁíÒ»¸ö°´Å¥£¬È»ºóÔٵȴý£¬ÕâÑùÒ»¸ö·´¸´µÄ¹ý³Ì¡£ÓÐÁË Ajax ºÍ XMLHttpRequest ¶ÔÏ󣬾ͿÉÒÔʹÓò»±ØÈÃÓû§µÈ´ý·þÎñÆ÷ÏìÓ¦µÄÇëÇó/ÏìӦģÐÍÁË¡£±¾ÎÄÖУ¬Brett McLaughlin ½éÉÜÁËÈçºÎ´´½¨Äܹ»ÊÊÓ¦²»Í¬ä¯ÀÀÆ÷µÄ ......
ÔÚ HTML µÄÍⲿÎļþÖÐÒ»Ñù£¬±ê¼ÇµÄ×éÖ¯ÓëÆäÑùʽ¡¢¸ñʽºÍÐÐΪÊÇ·ÖÀëµÄ¡£ËäÈ»Äú¿Ï¶¨¿ÉÒÔÓà JavaScript ¸ü¸ÄÔªËØ»òÎı¾µÄÑùʽ£¬µ«Êµ¼Ê¸ü¸ÄÄúµÄ±ê¼ÇËù²¼ÖõÄ×é֯ȴ¸ü¼ÓÓÐȤ¡£
Ö»ÒªÀμÇÄúµÄ±ê¼ÇֻΪÄúµÄÒ³ÃæÌṩ×éÖ¯¡¢¿ò¼Ü£¬Äú¾ÍÄÜÁ¢ÓÚ²»°ÜÖ®µØ¡£ÔÙÇ°½øһС²½£¬Äú¾Í»áÃ÷°×ä¯ÀÀÆ÷ÊÇÈçºÎ½ÓÊÜËùÓеÄÎı¾×éÖ¯²¢½«Æäת±äΪ³¬¼¶ÓÐȤµ ......
Java´úÂë
@Override
protected ModelAndView onSubmit(HttpServletRequest request, HttpServletResponse response, Object cmd,
BindException ex) {
&nb ......
ʹÓÃAJAXÖеÄUpdatePanel
ÔÚUpdatePanelÖÐÌí¼ÓÒ»GridView,Ìí¼ÓÁËRow_Updatingʼþ£º protected void gvUnitList_RowUpdating(object sender, GridViewUpdateEventArgs e)
{
GridViewRow row = gvUnitList.Rows[e.RowIndex];
UnitModel unit = new UnitModel();
unit.UnitID = Convert.ToI ......