如何在asp.net中发送和接收POST请求?

时间:2012-08-21 21:04:54

标签: c# jquery asp.net post javascript-events

我必须使用xml方法从aspx发送POST数据,并在另一个Aspx文件中接收参数。

我已将xml数据存储在名为javascript变量的xmlValidator中。我尝试使用以下代码,但它对我不起作用:

对于发送我写道:validator.aspx

<script type = "text/javascript">
    function submit_a() {
        $.post("../All.aspx", { "data": validatorXML }, function (result) {
         alert(result);
        });
 }
</script>

在接收点,即在All.aspx页面中,我写道:(从博客中读取)

<%@ Page Language="C#" AutoEventWireup="true" %>
 <%
   NameValueCollection nvc = Request.Form;
     Response.Write(nvc["data"]); //Here i have to call a method written in a .cs file
  // which return some data and print in `validator.aspx`
%>

但它什么都没打印。问题是什么?

1 个答案:

答案 0 :(得分:0)