//根据不同浏览器创建 httprequest对象
function createAjax(){
if (window.ActiveXObject){
var iex = new Array("MSXML2.XMLHTTP.5.0","MSXML2.XMLHTTP.4.0","MSXML2.XMLHTTP.3.0","MSXML2.XMLHTTP4","Microsoft.XMLHTTP");
for (var i = 0;i < iex.length;i++){
try{
var x = new ActiveXObject(iex[i]);
return x;
}
catch(err){}
}
return x;
}
else if (window.XMLHttpRequest){
var x = new XMLHttpRequest();
return x;
}
}
//通过httprequest对象 进行 post 调用
function GetDbsxCount(sid,amount) {
xmlHttp = createAjax(); //获取httprequest对象
var postString = "sid="+sid+"&amount="+amount ; //传递参数
var url = "commodity_updateAmount.action";
xmlHttp.open("post", url, false);
xmlHttp.setRequestHeader ("Content-Type", "application/x-www-form-urlencoded" )
//xmlHttp.onreadystatechange = callBack_CheckCount;
xmlHttp.send(postString); //传递参数
}
//回调函数,用来接收返回值
function callBack_CheckCount() {
if (4 == xmlHttp.readyState) {
if(200 == xmlHttp.status)
{
}
}
}