Skip to content

Instantly share code, notes, and snippets.

@lukehoban
Last active August 29, 2015 14:14
Show Gist options
  • Save lukehoban/dd315f330670e16eca68 to your computer and use it in GitHub Desktop.
Save lukehoban/dd315f330670e16eca68 to your computer and use it in GitHub Desktop.
var client = new WindowsAzure.MobileServiceClient(
"https://lukeh-todo-fri.azure-mobile.net/",
"qKxbOVPoAoQovsrxCKmEWhzTOrCZpL60"
);
function update() {
$("#todoBody").empty()
client.getTable("Todo").read().then(function (res) {
res.forEach(function (item) {
$("#todoBody").append($("<tr><td>" + item.text + "</td></tr>"))
});
});
}
$("#addTodo").click(function () {
var item = { text: $("#newTodo").val() };
client.getTable("Todo").insert(item).then(update)
})
update();
<h1>Todo List</h1>
<form class="form-inline">
<input type="text" class="form-control" placeholder="Add a new todo..." />
<btn typeof="submit" class="btn btn-primary">Add Todo</btn>
</form>
<br/>
<table class="table table-bordered">
<thead><tr><th>Topic</th></tr></thead>
<tbody>
<tr><td>Finish this section</td></tr>
<tr><td>Talk about Azure!</td></tr>
</tbody>
</table>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment