如何在客户端(javascript)调用服务器端的函数?

来源:百度知道 编辑:UC知道 时间:2024/04/29 06:23:26
我的情况是这样的:有几个服务器端的页都是连接数据库的(而且已经写成函数),我在主页上设了几个按钮,当点击其中一个时旁边的表格就显示相应的服务器页的内容,希望不用iframe,好像xmlhttp能实现,但我不会用
objXmlHttp.open "GET","http://www.google.com",false
上面这一句中的http://www.qq.com改成我的服务器页名test.asp又不行,
高手们打救打救我吧

// Request to Server

// Declare constant
var requestHeader_urlencoded = "application/x-www-form-urlencoded;";

// Declare XMLHttpRequest
var xmlHttp;

// Declare backMethod
var backMethod

// Init XMLHttpRequest
function createXMLHttpRequest()
{
if( window.ActiveXObject )
{
xmlHttp = new ActiveXObject( "Microsoft.XMLHTTP" );
}
else if( window.XMLHttpRequest )
{
xmlHttp = new XMLHttpRequest();
}
}

------------------------------------------------------------
<script language="JavaScript">

function send()
{
// @HuLiejian 注释
var url = "login.do?curDate=" + new Date().getTime();

var xml = createXML();

createXMLHttpRequest();
xmlHttp.open( "post", url, true );
xmlHttp.onreadystatechange = handleStateChange;
xmlHt