From b6da2d95b5b4c6d83fd48d3f83d7aa1294174945 Mon Sep 17 00:00:00 2001 From: zouap Date: Tue, 29 Mar 2022 17:38:05 +0800 Subject: [PATCH] =?UTF-8?q?=E6=8F=90=E4=BA=A4=E4=BB=A3=E7=A0=81=EF=BC=8C?= =?UTF-8?q?=E9=87=8D=E5=AE=9A=E5=90=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: zouap --- public/home/search.js | 36 +++++++++++++++++++++++++----------- 1 file changed, 25 insertions(+), 11 deletions(-) diff --git a/public/home/search.js b/public/home/search.js index 670940786..9bdc30a89 100644 --- a/public/home/search.js +++ b/public/home/search.js @@ -188,20 +188,34 @@ function initDiv(isSearchLabel=false){ } function searchLabel(tableName,keyword,sortBy="",ascending="false"){ + + var httpRequest = new XMLHttpRequest();//第一步:创建需要的对象 + httpRequest.open('POST', '/all/search/', true); //第二步:打开连接 + httpRequest.setRequestHeader("Content-type","application/x-www-form-urlencoded");//设置请求头 注:post方式必须设置请求头(在建立连接后设置请求头) + httpRequest.send("q=" + keyword + "&tableName=" + tableName + "&searchLabel=true");//发送请求 将情头体写在send中 + + httpRequest.onreadystatechange = function () {//请求后的回调接口,可将请求成功后要执行的程序写在其中 + if (httpRequest.readyState == 4 && httpRequest.status == 200) {//验证请求是否发送成功 + var json = httpRequest.responseText;//获取到服务端返回的数据 + console.log(json); + } + }; + + console.log("enter label search."); - initDiv(true); - //document.getElementById("search_div").style.display="none"; - //document.getElementById("search_label_div").style.display="block"; - document.getElementById("search_label_div").innerHTML="

#" + keyword + "

"; + // initDiv(true); + // //document.getElementById("search_div").style.display="none"; + // //document.getElementById("search_label_div").style.display="block"; + // document.getElementById("search_label_div").innerHTML="

#" + keyword + "

"; - currentSearchKeyword = keyword; - initPageInfo(); - currentSearchTableName = tableName; - currentSearchSortBy = sortBy; - currentSearchAscending = ascending; - OnlySearchLabel =true; + // currentSearchKeyword = keyword; + // initPageInfo(); + // currentSearchTableName = tableName; + // currentSearchSortBy = sortBy; + // currentSearchAscending = ascending; + // OnlySearchLabel =true; - page(currentPage); + // page(currentPage); } function doSearch(tableName,keyword,page,pageSize=15,onlyReturnNum=true,sortBy="",OnlySearchLabel=false){