$就({});不适用于类型:在jquery 1.10.2 min.js中的asp.net中的POST

时间:2015-08-12 10:54:59

标签: javascript jquery asp.net ajax

适用于type =“GET”,但在type =“POST”的情况下,它返回NULL值。

 function __callbackprocessing(trdata) {
    var notfound = "<table cellspacing='0' cellpadding='0' width='100%' border='0' class='Top_Bar'><tbody><tr><td valign='center' align='left'><table cellspacing='0' cellpadding='0' border='0' style='width: 100%'><tbody><tr><td class='Top_Bar_txt' valign='center' align='left' width='85'>Search Results :</td><td valign='center' align='right'><img height='16' alt='Basket' src='../images/Icon_add_basket.gif' width='20' /> </td><td valign='center' align='left'><table>";
    if (ExportToExcel) {
        $("#modalPopupMask").replaceWith("<div id='modalPopupMask' name='modalPopupMask'class='modalPopupMask'></div>");
        $('#imgProcess').replaceWith("<img src='../images/Processing_animation.gif' id='imgProcess' style='z-index: 2000; position: absolute; left: 450px; top: 300px;' align='center' valign='middle' />");
               }

    $.ajax({
         type: "GET",           
        //type: "POST",
         url: "../WebForms/Search.aspx",             
         data: "data=" + trdata,                          
         contentType: "application/x-www-form-urlencoded; charset=utf-8",
         success: function (data, status) { });});

C#代码: -     protected void Page_Load(object sender,EventArgs e)     {
        String isPost = Request.Params [“data”];         isQuery = Request.QueryString [“Search”]; }

1 个答案:

答案 0 :(得分:-1)

如果您正在传递POST,我建议您在将数据推送到数据中的Ajax之前定义变量。

Var submit = $('#submit')。val();

数据:{submit:submit,etc:etc}

还包括您要将数据发布到的网址。