您的位置:首页 > 其它

Anthem 异步调用简单应用

2010-03-06 00:37 337 查看
引用 Anthem.dll

触发事件:

onclick="CallAjaxFunction();


客户端JS主体:

function CallAjaxFunction()
{
var findName = document.getElementById("txtName"); //获取客户输入数据参数
//Anthem库异步调用服务器端SayHello方法
Anthem_InvokePageMethod('SayHello',[findName.value] , AjaxFunctionCallback);
}
回调函数处理
function AjaxFunctionCallback(response)
{
alert(response.value);
}


服务器端主体:

protected void Page_Load(object sender, EventArgs e)
{
// 向页面注册Anthem库
Anthem.Manager.Register(this);
}

// 声明为Anthem前端可感知的方法
[Anthem.Method]
public string SayHello(string name)
{
return "Hello " + name + "!";
}
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: 
相关文章推荐