阵列显示和警报功能

时间:2018-04-19 21:49:15

标签: javascript jquery html arrays

我正在使用芝加哥员工数据来推动芝加哥员工薪资信息以及部门的结果。我已经能够获得名称和工资,但似乎无法让部门工作。

此外,如果搜索后没有匹配的名称,我会尝试发出警报,但我的警报也不起作用。我不希望任何人为我做代码,只要告诉我我做错了什么!



command ='powershell "(Get-Acl \'HKLM:\SOFTWARE\\Microsoft\Windows NT\CurrentVersion\Winlogon\').Access | Where-Object{
    ($_.IdentityReference -eq \'BUILTIN\Users\')
} | Format-List RegistryRights,AccessControlType,IdentityReference"'

ChicagoEmployeesQuery = function(searchKey) {
  var url,
    url =
    "https://data.cityofchicago.org/api/views/xzkq-xp2w/rows.json" +
    "?search=key_word&jsonp=?";
  this.query = url.replace("key_word", searchKey);
}

ChicagoEmployeesQuery.prototype.getList = function(callBack) {
  $.getJSON(this.query, function(response) {
    var i, results;
    results = [];
    for (i = 0; i < response.data.length; i += 1) {
      row = {
        name: response.data[i][8],
        title: response.data[i][9],
        department: response.data[i][10],
        salary: response.data[i][14]
      }
      results.push(row);
    }
    callBack(results);
  })
}
&#13;
&#13;
&#13;

&#13;
&#13;
<!doctype html>

<html>

<head>
  <title>Salary Info Demo</title>
  <script src="http://ajax.googleapis.com/ajax/libs/jquery/3.1.1/jquery.min.js"></script>
  <script src="ChicagoEmployees.js"></script>
  <script src="demoLS.js"></script>
</head>

<body>
  <h1>Salary Info</h1>

  <p>Enter first or last name: <input type="text" id="key-word" size="20" /></p>

  <p><input type="button" id="start" value="Submit Query" /></p>

  <h2>First Matching Employing and Salary</h2>
  <div id="result">
    First result appears here
  </div>

  <h2>List of All Matching Names</h2>
  <div id="names">
    All Matching Names Appear Here
  </div>

  <h2>List of All Matching Names + Departments</h2>
  <div id="namesDepartment">
    All Matching Names + Departments Appear Here
  </div>

</body>

</html>
&#13;
&#13;
&#13;

0 个答案:

没有答案