Ajax ÊÖдJS
var httpRequest = false;
var mesdivs = null
function sendRequest(url, mesdiv) {
mesdivs = mesdiv;
httpRequest = false;
if (window.XMLHttpRequest) {
httpRequest = new XMLHttpRequest();
if (httpRequest.overrideMimeType) {
}
}
else if (window.ActiveXObject) {
try {
httpRequest = new ActiveXObject("Msxml2.XMLHTTP");
}
catch (e) {
try {
httpRequest = new ActiveXObject("Microsoft.XMLHTTP");
}
catch (e) {
}
}
}
if (!httpRequest) {
window.alert("no");
}
if (mesdivs == "sendmes") {
httpRequest.onreadystatechange = function() {
if (httpRequest.readyState == 4) {
if (httpRequest.status == 200) {
var string = httpRequest.responseText;
&
Ïà¹ØÎĵµ£º
±¾ÎĵØÖ·: jQuery Ajax È«½âÎö
±¾ÎÄ×÷ÕߣºQLeelulu
תÔØÇë±êÃ÷³ö´¦£¡
jQueryȷʵÊÇÒ»¸öͦºÃµÄÇáÁ¿¼¶µÄJS¿ò¼Ü£¬ÄÜ°ïÖúÎÒÃÇ¿ìËٵĿª·¢JSÓ¦Ó㬲¢ÔÚÒ»¶¨³Ì¶ÈÉϸıäÁËÎÒÃÇдJavaScript´úÂëµÄÏ°¹ß¡£
·Ï»°ÉÙ˵£¬Ö±½Ó½øÈëÕýÌ⣬ÎÒÃÇÏÈÀ´¿´Ò»Ð©¼òµ¥µÄ·½·¨£¬ÕâЩ·½·¨¶¼ÊǶÔjQuery.ajax()½øÐзâ×°ÒÔ·½±ãÎÒÃÇʹÓõķ½·¨£¬µ±È»£¬È ......
2.1Microsoft Ajax LibraryËÙÀÀ£º
Microsoft Ajax LibraryÊÇÒ»×é¿ÉÒÔä¯ÀÀÆ÷¶Ë¶ÀÁ¢ÔËÐеÄJavaScriptº¯Êý¿â£¬°üº¬ÍøÒ³ºËÐÄ·þÎñÒÔ¼°Ìṩä¯ÀÀÆ÷µÄXMLÔ¶³ÌÊý¾Ý´æÈ¡ÄÜÁ¦¡£
Ö§³ÖµÄä¯ÀÀÆ÷ÓУºIE¡¢Mozilla¡¢Firefox¡¢Apple Safari¡£
2.1.2ÔÚASP.NETÒ³ÃæÖÐÔö¼ÓAjaxÖ§³Ö
Ajax LibraryÊÇרΪAjax¹¦ÄÜÌṩµÄScript£¬ËüÊ ......
ÕâÊÇÒ»¸ö»ùÓÚprototype.jsµÄajax·ÖÒ³£¬ÔËÓÃÁËspring¿ò¼Ü£¬×Ô¶¨Òå·ÖÒ³±êÇ©£¬Ã¿´Î½øÈëÁбíÒ³Ãæʱ£¬°ÑÁбí´æÈësession£¬·ÖÒ³Ö»¶Ôsession´æ´¢µÄÁбí½øÐзÖÒ³£¬²»ÐèÒªÔÙÈ¥²éѯÊý¾Ý¿â£¬ÐÔÄÜ»á¸ßЩ
Ê×ÏÈÔÚweb.xmlÖÐÅäÖÃspring¼àÌýºÍservlet
web.xmlÄÚÈÝÈçÏ£º
<?xml version="1.0" encoding="UTF-8"?>
<web-app versi ......
jqueryÖÐÓÃajax(òËƱàÂëĬÈÏΪutf-8)Èç¹ûÓÐÖÐÎĵĻ° »á³öÏÖÂÒÂë ÏÂÃæµÄ½â¾ö°ì·¨Ö®Ò»£º
ÒÔÏÂÊÇjsÖеĴúÂë
classname=encodeURI($('#classname').val());
classdescription=encodeURI($('#classdescription').val());
actionArr={classname:classname,classdescription:classdescription};
$.post("product_class ......