前端ajax和aspx之间参数的传递,前端向后台传递数值

来源:互联网 发布:unity3d 语音聊天插件 编辑:程序博客网 时间:2024/05/17 22:18

前端

<script>

function btnclick(){

$.ajax({

url:"WebForm1.aspx",

data:
                    {
                        orderId:"2",
                        commant:"commnat",
                    } ,

type: "Post",
                dataType: "Json",

success:function(result){

}

})

}

<script>

后台程序:

protected void Page_Load(object sender, EventArgs e)
        {
            string id = Request["orderId"];
            string cc = Request["commant"];
           
            if (!string.IsNullOrEmpty(id))
            {
               
            }
        }

可以观察到,id=2,cc=commnat,ok~