簡體   English   中英

jQuery的UI選項卡不發布數據到asp.net(C#)

[英]jquery ui tab not posting data to asp.net(c#)

jqueryUI選項卡的HTML。

<div id="lodg_tabs" class="tabs">
    <ul>
        <li><a href="#tabs-1">Add/Remove</a></li>
        <li><a href="mand_lodg_upd.aspx">Update</a></li>
    </ul>
    <div id="tabs-1" class="forms">
        <h3 align="center">Mandate Lodgment</h3>
        <form name="mand_lodg" id="mand_lodg" method="post"> 

ajax代碼,將參數發送到加載“ mand_lodg_upd.aspx”的選項卡

$("#lodg_tabs").tabs({
    select: function (event, ui) {
        var res = valid('mand_lodg');
        $(this).tabs("option", { ajaxOptions: { data: $("#mand_lodg").serialize()} });
     },
     ajaxOptions: {
         type: 'POST',
         error: function (xhr, status, index, anchor) {
             $(anchor.hash).html("An error has been encountered while attempting to load this tab.");
         }
     },
     cache: false
});

后面的C#代碼

Response.Write(Request.Form["zone"] + Request.QueryString["zone"]);
            zone.Value = Request.Form["zone"];
            loc.Value = Request.Form["loc"];
            date.Value = Request.Form["date"];

輸出:輸出正常,文件正在選項卡中加載

問題:但是參數通過ajax即傳遞

$(this).tabs("option", { ajaxOptions: { data: $("#mand_lodg").serialize()} });

區域位置和日期在后面的C#代碼中為空

Request.Form通過POST方法引用HTTP請求參數。 默認情況下,jQuery發出GET方法請求。 嘗試像這樣設置AJAX選項:

$(this).tabs("option", { 
    ajaxOptions: { 
                   type: 'post', 
                   data: $("#mand_lodg").serialize()
                 } 
});

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM