$(function () {
    $(".logo button").click(function () {
        var content = $("#Sou").val();
        var type = $("#selectType").val();
        if(content.trim().length<2){
            layer.tips("请至少输入两个字符","#Sou");
        }else{
            if(type=="供应"){
                window.location.href="../spzs/?search="+content;
            }else if(type=="采购"){
                window.location.href="../syjh/qiugou.htm?search="+content;
            }else if(type=="企业"){
                window.location.href="../qyml/?search="+content;
            }else if(type=="资讯"){
                window.location.href="../hyxx/informationSearch.html?search="+content;
            }else if(type=="百科"){
                window.location.href="../qyfw/encyclopediaSearch.html?search="+content;
            }
        }
    });
    getAdb();
});

function getAdb() {
    $.ajax({
        url:url+"/tbgj/tbgj/listForPage",
        data:{},
        type:"get",
        dateType:"jason",
        async:true,
        success:function (response) {
            var table1 = "<tr><th>位置</th><th>月付</th><th>半年付</th><th>年付</th><th>规格</th></tr>";
            var table2 = "<tr><th>位置</th><th>月付</th><th>半年付</th><th>年付</th><th>规格</th></tr>";
            $.each(response,function (i, list) {
                if(i==4){
                    table1+="<tr>" +
                        "<td class='td-kuan'>"+list.position+"</td>" +
                        "<td class='td-kuan'>"+list.month+"</td>" +
                        "<td class='td-kuan'>"+list.half+"</td>" +
                        "<td class='td-kuan'>"+list.year+"</td>" +
                        "<td class='td-kuan'>"+list.size+"</td>" +
                        "</tr>";
                }else{
                    table2+="<tr>" +
                        "<td class='td-kuan'>"+list.position+"</td>" +
                        "<td class='td-kuan'>"+list.month+"</td>" +
                        "<td class='td-kuan'>"+list.half+"</td>" +
                        "<td class='td-kuan'>"+list.year+"</td>" +
                        "<td class='td-kuan'>"+list.size+"</td>" +
                        "</tr>";
                }
            });
            console.log(table1);
            console.log(table2);
            $("#tb1").html(table2);
            $("#tb2").html(table1)
        },
        error:function (e) {
            console.log(e.status);
            console.log(e.responseText);
        }
    });
}