ajax同时返回list和字符串,我在页面的后台代码中写了个方法 getList() 返回的是个 string[] 类型的数组,要在javascript 中调用...

// //**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+')');

*}

*/

项目中的源代码

取消

评论