// //**AJAX**// //
tools.ajax.conn = function ajaxSubmit(url,postStr,action) {
var ajax=false;
try { ajax = new ActiveXObject(Msxml2.XMLHTTP); }
catch (e) { try { ajax = new ActiveXObject(Microsoft.XMLHTTP); } catch (E) { ajax = false; } }
if (!ajax && typeof XMLHttpRequest!='undefined') ajax = new XMLHttpRequest();
ajax.open(post, url, true);//post方式
ajax.setRequestHeader(Content-Type,application/x-www-form-urlencoded);
ajax.send(postStr);
ajax.onreadystatechange = function() {
if (ajax.readyState == 4 && ajax.status == 200) {
if ( !action || action == ) alert(ajax.responseText);
else eval(action+('+escape(ajax.responseText)+'));
}
}
}
/**使用实例**/
/*
*ajaxSubmit(appList.php,getcount=+getcountTab+&tabvalue=all,getcount);
*function getcount(response){
*var response = unescape(response);
*response = eval('('+response+')');
*}
*/
项目中的源代码
取消
评论