使用xmlhttprequest.open("post",url,ture) 时关于参数的问题

sky1314 2008-06-11 02:11:39
 我要通过些方法xmlHttp.open("POST", "URL",true),调Default.aspx.cs页面中check()方法,URL应该怎么写啊,急哦!!
...全文
779 7 打赏 收藏 转发到动态 举报
写回复
用AI写文章
7 条回复
切换为时间正序
请发表友善的回复…
发表回复
sky1314 2008-06-11
  • 打赏
  • 举报
回复
那个show do 还在不在呀,还有是些地方没明白,需要请教
可否加一下我的MSN,
sunshina1314@hotmail.com
Go 旅城通票 2008-06-11
  • 打赏
  • 举报
回复
[Quote=引用 5 楼 sky1314 的回复:]
在线谢谢,那个showbo ,头像酷似胡汉三的朋友,
[/Quote]
......胡汉三???

是宪哥好不.....汗.....
sky1314 2008-06-11
  • 打赏
  • 举报
回复
在线谢谢,那个showbo ,头像酷似胡汉三的朋友,
Go 旅城通票 2008-06-11
  • 打赏
  • 举报
回复
搞错,上void类型的...不需要返回了

protected void check()
{
Response.Write("AJAX Call Server Method of check()");
}
Go 旅城通票 2008-06-11
  • 打赏
  • 举报
回复
一个简单的例子
test.aspx
<%@ Page Language="C#"  %>
<script runat="server">
protected void Page_Load(object sender,EventArgs e)
{
if(Request.Form["call"]=="1"){check();Response.End();}
}
protected string check()
{
Response.Write("AJAX Call Server Method of check()");
}
</script>

<script>
if(window.ActiveXobject)xmlHttp=new ActiveXObject("Microsoft.xmlhttp");
else xmlHttp=new XMLHttpRequest();
xmlHttp.open("POST", "test.aspx",true);
xmlHttp.onreadystatechange=function()
{
if(xmlHttp.readyState==4)
{
if(xmlHttp.status==200)alert(xmlHttp.responseText);
else alert("发生错误!");
}
}
xmlHttp.send("call=1");

</script>
sky1314 2008-06-11
  • 打赏
  • 举报
回复
我还是有些晕啊,
URL=“default.aspx”后,xmlhttprequest 如何去操作我想要操作的方法,如Check 在哪处指定啊?
xiaojing7 2008-06-11
  • 打赏
  • 举报
回复
default.aspx页面里面只需要
<%@ Page Language="C#" AutoEventWireup="true"  CodeFile="Default.aspx.cs" Inherits="_Default" %>

这句话

然后在vdefault.aspx.cs 写你的方法

url 直接写:default.aspx就可以了

52,797

社区成员

发帖
与我相关
我的任务
社区描述
Web 开发 Ajax
社区管理员
  • Ajax
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧