JSFiddle - React, Tailwind, and code Playground
HTML
<script src="http://knockoutjs.com/downloads/knockout-2.0.0.js"></script>
<table>
<thead>
<tr><th>File Name</th></tr>
</thead>
<tbody data-bind="foreach: attachments">
<tr><td data-bind="text: Filename" /></tr>
</tbody>
</table>
<button id="refresh">Refresh</button>
JavaScript
$(function () {
$("#refresh").on("click", getAttachments);
});
$(function () {
getAttachments();
});
function vm(response) {
this.attachments = ko.observableArray(response);
};
function getAttachments() {
// Ajax call would return this:
var response = [{ Filename: "f1.doc" }, { Filename: "f2.doc"}];
ko.applyBindings(new vm(response));
}