如何通过asp.net中的post方法发送和接收数据? [英] How Send and receive data through the post method in asp.net?

查看:134
本文介绍了如何通过asp.net中的post方法发送和接收数据?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

你好朋友



如何通过asp.net中的post方法发送和接收数据?



没有查看page2,只能通过post方法发送和接收page2的数据

tnx

Hello friends

How Send and receive data through the post method in asp.net?

without view page2 ,only send and receive data of page2 by post method
tnx

推荐答案

你需要知道Jquery Ajax Post方法程序访问page2数据而不查看page2。这是它的工作原理。



You need to know Jquery Ajax Post method procedure to access page2 data without viewing page2. That is how it works.

function ShowCurrentTime() {


.ajax({
type: POST
url: CS.aspx / GetCurrentTime
数据: ' {name:' +
.ajax({ type: "POST", url: "CS.aspx/GetCurrentTime", data: '{name: "' +


#<%= txtUserName.ClientID%>)[ 0 ]。value + ' }'
contentType: application / json; charset = utf-8
dataType: json
成功:OnSuccess,
失败: function (response){
alert(response.d);
}
});
}
function OnSuccess(响应){
alert(response.d);
}
("#<%=txtUserName.ClientID%>")[0].value + '" }', contentType: "application/json; charset=utf-8", dataType: "json", success: OnSuccess, failure: function(response) { alert(response.d); } }); } function OnSuccess(response) { alert(response.d); }





这里cs.aspx是你的page2,而GetCurrentTime是cs.aspx的方法之一。通过使用输入(值为txtUserName)调用它,我们获取值并在警报中显示输出。



欲了解更多信息,请点击此处。 使用jQuery AJAX调用ASP.Net WebMethod [ ^ ]。


这篇关于如何通过asp.net中的post方法发送和接收数据?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆