Skip to content

Instantly share code, notes, and snippets.

@phette23
Created January 7, 2020 18:05
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save phette23/3d8a58fd5200b255914929b8efcd493f to your computer and use it in GitHub Desktop.
Save phette23/3d8a58fd5200b255914929b8efcd493f to your computer and use it in GitHub Desktop.
Koha public report -> HTML table
$.get('https://library.cca.edu/cgi-bin/koha/svc/report?id=130', function(data) {
// header row
let html = '<table><thead><th>Field One</th><th>Field Two</th><th>Field Three</th></thead><tbody>'
// content rows
data.forEach(row => {
html += '<tr>'
row.forEach(value => html += `<td>${value}</td>`)
html += '</tr>'
})
// close tags (optional), add to DOM
html += '</tbody></table>'
$('body').append(html)
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment