繁体   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