jquery ajax post to .aspx page load - how to read variable p

jquery ajax post to .aspx page load - how to read variable posted?

本文关键字:to read how variable page ajax post aspx jquery load      更新时间:2023-09-26

我正在尝试向aspx页面发布ajax帖子。如何读取变量"myVar"? 在下面的代码中HttpContext.Current.Request("myVar")什么也没返回

var p = { "myVar": JSON.stringify(tableOBJ) };
$.ajax({
    type: "POST",
    url: "Default2AJAX.aspx",
    data: p,
    success: function (data) {
    }
});

默认2AJAX.aspx代码隐藏

Partial Class Default2AJAX
    Inherits System.Web.UI.Page
    Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
        Dim s As String = HttpContext.Current.Request("myVar") ''not working???????
    End Sub
End Class

我认为应该是

HttpContext.Current.Request.Form("myVar")