Posted on 2009-10-22 08:04
S.l.e!ep.¢% 閱讀(266)
評(píng)論(0) 編輯 收藏 引用 所屬分類:
HTML
function xmlHttpPost(page,data){
? var xmlhttp = new ActiveXObject("MSXML2.XMLHTTP");
? xmlhttp.open("POST", page ,false);
? xmlhttp.setRequestHeader("CONTENT-TYPE","application/x-www-form-urlencoded");
? xmlhttp.send(data);
? return(xmlhttp.ResponseText);
}
參數(shù)解釋
??? page :用調(diào)用的URL,即響應(yīng)程序。
??? data? :采用POST的方式提交數(shù)據(jù)。data參數(shù)保存形式入“username=zdyue&user_id=00001”這樣的數(shù)
???????????????? 據(jù)。
??? return :返回結(jié)果是響應(yīng)程序執(zhí)行的結(jié)果,可以是XML數(shù)據(jù),也可以是1,0等數(shù)據(jù)表示提交執(zhí)行的
????????????????? 結(jié)果
備注
??? data中提交的數(shù)據(jù)需要編碼,比如在“值”中有中文,=,&這類的字符時(shí)候需要URL編碼。
??? 這個(gè)編碼網(wǎng)上有實(shí)現(xiàn)的函數(shù)。
?
本文來自CSDN博客,轉(zhuǎn)載請(qǐng)標(biāo)明出處:http://blog.csdn.net/zdyue/archive/2004/06/28/28949.aspx