jquery POST data in aspx page

后端 未结 2 1894
失恋的感觉
失恋的感觉 2021-01-28 02:18

I post data to my aspx file qith the following code:

 $.ajax({
            type: \'POST\',
            url: \"Ajax_Text.aspx?rand=\" + myRand
                            


        
相关标签:
2条回答
  • 2021-01-28 02:30

    POST data are not send in query string but added to the request body. Try this code:

    $.ajax({
            type: 'POST',
            url: "Ajax_Text.aspx",
            data: {'rand': myRand, 'id': $(".articleID").attr('title'), 'text': $("#text").val()},
            cache: false,
            beforeSend: function () {
    
            },
            success: function (data) {
                alert(data); 
            }
        });
    
    0 讨论(0)
  • 2021-01-28 02:52

    You are "posting" the data (text) as a query string (as part of URL) so you have to use Request.QueryString.

    0 讨论(0)
提交回复
热议问题