2

已经设置了几个我想搜索的站点,在 javascript 中创建的页面允许我输入一个值并搜索多个连接器,但希望找到更好的方式来显示结果。目前,只需获得由换行符分隔的结果。理想情况下,希望表格中的结果带有可点击的链接和添加的源数据库的名称,就像在 Import.io 程序本身中运行搜索时看到的那样。当前代码如下。任何帮助将非常感激!

<!DOCTYPE html>
<html>
<head>
<title>Canton Search 5000</title>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script>
<!-- 1. Include the client library -->
<script src="https://cdn.import.io/js/2.0.0/importio.js"></script>

<!-- 2. Configure the library -->
<script type="text/javascript">
importio.init({
  "auth": {
    "userGuid": "3969d665-a06a-4738-9d1a-d691589d5f77",
    "apiKey": "CFKNykJp/dd5ee9rUUe2DWa/cNRmLLi2ibHQzs95ZuL6V4Culdq7c1wShLyO9Ed6CsRrgBJ4gP/Y72VaJPxezA=="
  },
  "host": "import.io"
});

// Data and done callbacks
var dataCallback = function(data) {
  console.log("Data received", data);
  for (var i = 0; i < data.length; i++) {
    var d = data[i];
    for (var k in d.data) {
      document.write("<i>" + k + "</i>: " + d.data[k] + "<br />");
    }
    document.write("<hr>");
  }
}
var doneCallback = function(data) {
  console.log("Done, all data:", data);
  document.write("<b>Done</b><hr>");
}

// 3. Do the query (when the function is called)
var doQuery = function() {
    var firstinputQuery = document.getElementById("name").value;
  // Query for tile Warrants
  importio.query({
    "connectorGuids": [
      "1e5989be-bcc3-4d29-91fd-003f8a603da9",
      "e1282ac5-8a98-4848-a907-9a0719ea51aa",
      "5e3e9f4b-d7f0-4b24-b646-62455cb2f174"
    ],
    "input": {
      "name": firstinputQuery,

    }
  }, { "data": dataCallback, "done": doneCallback });
}


window.onload = function(){
document.getElementById("unselectall").onchange = function()  {Check(document.myform)};
};  

</script>
 <body>

<p>
Name:&nbsp<input type="text" id="name" placeholder="enter name here">
<p><tr>


</form>


    <br><button onclick="doQuery()">Search Them Cantons</button>


 </body>
</html>
4

0 回答 0