日期:2014-05-17 浏览次数:20817 次
$.ajax({
type:"POST",
url: _url,
data: {
"param1": param1
"param2": param2
},
dataType: "json",
async: false,
cache: false,
success: function(data) {
},
error: function(){
}
});
var infoListHttpRequest = null;
function getInfoList(){
//创建Ajax连接
if (window.ActiveXObject) {
infoListHttpRequest = new ActiveXObject("Microsoft.XMLHTTP");
} else if (window.XMLHttpRequest) {
infoListHttpRequest = new XMLHttpRequest();
}
//action、servlet路径
var url = "./GetInfoList?timeStamp=" + new Date().getTime();
infoListHttpRequest.open("POST", url, true);
//ajax取出数据后执行的方法setCarList2Grid
infoListHttpRequest.onreadystatechange = setInfoList2Select;
infoListHttpRequest.setRequestHeader("Content-Type",
"application/x-www-form-urlencoded; charset=UTF-8");
//post时候发送的参数
infoListHttpRequest.send(null);
}
/**
* 将取出的信息放到页面
*/
function setInfoList2Select(){
if (setInfoList2Select.readyState == 4) {
if (setInfoList2Select.status == 200) {
var rStr = setInfoList2Select.responseText;
//将取出的信息转换成json串
var jsonStr= eval ("(" + rStr + ")");
}
}
}