automated terminal push
This commit is contained in:
120
web/js/jobs.js
Normal file
120
web/js/jobs.js
Normal file
@@ -0,0 +1,120 @@
|
||||
|
||||
$(document).ready(function () {
|
||||
|
||||
fetch();
|
||||
|
||||
setInterval(fetch, 1000*120);
|
||||
|
||||
});
|
||||
function fetch() {
|
||||
|
||||
console.debug(" -> :: fetchLeaderboardDetails()");
|
||||
|
||||
$.ajax({
|
||||
|
||||
type: "GET",
|
||||
|
||||
url: "http://localhost:8888"+ "/jobs/",
|
||||
|
||||
dataType: 'json', // <-- Set dataType to 'json'
|
||||
|
||||
//contentType: "text/plain",
|
||||
|
||||
crossDomain: false,
|
||||
|
||||
success: function (data, status, jqXHR) {
|
||||
|
||||
console.log("good");
|
||||
|
||||
profitleaderboard(data);
|
||||
|
||||
},
|
||||
|
||||
error: function (error, status) {
|
||||
|
||||
console.log("error fetching leaderboard", error);
|
||||
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
}
|
||||
function load() {
|
||||
|
||||
console.debug(" -> :: fetchLeaderboardDetails()");
|
||||
|
||||
$.ajax({
|
||||
|
||||
type: "GET",
|
||||
|
||||
url: "http://localhost:8888"+ "/jobs/load",
|
||||
|
||||
dataType: 'json', // <-- Set dataType to 'json'
|
||||
|
||||
//contentType: "text/plain",
|
||||
|
||||
crossDomain: false,
|
||||
|
||||
success: function (data, status, jqXHR) {
|
||||
|
||||
console.log("good");
|
||||
|
||||
profitleaderboard(data);
|
||||
|
||||
},
|
||||
|
||||
error: function (error, status) {
|
||||
|
||||
console.log("error fetching leaderboard", error);
|
||||
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
function profitleaderboard(jobList) {
|
||||
|
||||
console.log("jobList / " ,jobList);
|
||||
|
||||
var html = '';
|
||||
|
||||
size = jobList.length;
|
||||
|
||||
console.log("size / " + size);
|
||||
|
||||
for (var i =0;i< jobList.length; i++) {
|
||||
|
||||
html += '<tr>';
|
||||
|
||||
html += '<td class="METADATA DEBUG">' + (i+1) + '</td>'; // Integer (ranking)
|
||||
html += '<td class="METADATA DEBUG">' + jobList[i].site + '</td>'; // Integer (ranking)
|
||||
html += '<td class="METADATA DEBUG">' + jobList[i].company + '</td>'; // String (username)
|
||||
|
||||
html += '<td class="METADATA DEBUG"><a target="_job" href="' + jobList[i].job_url + '">'+jobList[i].title+ '</a></td>';
|
||||
|
||||
// html += '<td class="METADATA DEBUG">' + + '</td>'; // String (username)
|
||||
|
||||
html += '<td class="METADATA DEBUG">' + jobList[i].location + '</td>'; // String (username)
|
||||
html += '<td class="METADATA DEBUG">' + jobList[i].job_type + '</td>'; // String (username)
|
||||
html += '<td class="METADATA DEBUG">' + jobList[i].is_remote + '</td>'; // String (username)
|
||||
|
||||
|
||||
|
||||
html += '<td class="METADATA DEBUG">' + jobList[i].description + '</td>'; // String (username)
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
html += '</tr>';
|
||||
|
||||
}
|
||||
|
||||
$('#leaderboard > tbody').html(html);
|
||||
|
||||
}
|
Reference in New Issue
Block a user