浏览模式: 普通 | 列表
4月, 2008 | 1

ajax模拟表单提交的方法

[ 2008-04-22 14:11:39 | 作者: admin ]
<form method="post" action="test.do" onsubmit="sendRequest();return false">
</form>
function getRequestBody(oForm){
     var aParams=new Array();
     for(var i=0;i<oForm.elements.length;i++){
         var sParam=encodeURIComponent(oForm.elements[i].name);
   sParam+="=";
   sParam+=encodeURIComponent(oForm.elements[i].value);
   sParams.push(sParam);
     }
     return aParams.join("&");
}

function sendRequest(){
...

阅读全文…

Ajax的post方式提交数据

[ 2008-04-22 14:08:11 | 作者: admin ]
Ajax的post方式提交数据
引用
<SCRIPT LANGUAGE="javascript">
<!--

function saveUserInfo()
{
//获取接受返回信息层
var msg = document.getElementById("msg");

//获取表单对象和用户信息值
var f = document.user_info;
var userName = f.user_name.value;
var userAge = f.user_age.value;
var userSex = f.user_sex.value;

//接收表单的URL地址
var url = "http://www.52News.com";
//需要POST的值,把每个变量都通过&来联接
var postStr = "name="+ userName
...

阅读全文…

xmlhttp 与 cookie

[ 2008-04-22 13:19:27 | 作者: admin ]
Dim logxml, idpw, postxml, info, cookie

idpw="id=abc&pw=pass"
Set logxml = Server.CreateObject("Microsoft.XMLHTTP")
logxml.Open "POST", "http://myserver/login", False
logxml.Send idpw
cookie = logxml.getResponseHeader("Set-Cookie")

'info="title=hello&content=world"

Set postxml = Server.CreateObject("Microsoft.XMLHTTP")
postxml.Open "POST", "http://myserver/post", False
postxml.setRequestHeader("Cookie",cookie)
...

阅读全文…
1