@{
    ViewBag.Title = "";
    Layout = "~/Views/Shared/_LayoutTable.cshtml";
}
<div class="wrapper wrapper-content">
    <div class="ibox-content">
        <table class="table table-bordered table-striped table-hover">
            <tr>
                <td>
                    <span style="display: block; float: left; margin-left: 10%; margin-top: 5px;">行业类型：</span>
                </td>
                <td>
                    <input id="tradeType" maxlength="10" type="text"   />
                </td>
                <td>
                    <button id="btnSave" class="btn btn-default"><i class="glyphicon glyphicon-saved"></i> 保存</button>
                </td>
            </tr>
        </table>
    </div>
</div>
<script type="text/javascript">
    $(function () {
        $("#btnSave").click(function () {
            if (!$("#tradeType").val()) {
                var index = parent.layer.getFrameIndex(window.name);
                parent.layer.close(index);
                return;
            }
            $.ajax({
                url: "../DataQuery/AddTrade",
                data: {
                    tradeName: $("#tradeType").val()
                },
                dataType: "text",
                type: "post",
                success: function (data) {
                    if (data == "ok") {
                        parent.layer.msg("保存成功", { icon: 1, tiem: 2000 });
                        parent.$('#businessTable').bootstrapTable('refresh');
                        var index = parent.layer.getFrameIndex(window.name); //先得到当前iframe层的索引
                        parent.layer.close(index);
                    } else {
                        layer.msg("添加失败或行业类型已存在", { icon: 2, tiem: 2000 });
                    }
                },
                error: function () {
                    layer.msg("连接超时", { icon: 1, tiem: 2000 });
                }
            })
        });
    })
</script>
