Skip to content

Instantly share code, notes, and snippets.

@JustinJohnWilliams
Created March 18, 2013 20:35
Show Gist options
  • Save JustinJohnWilliams/5190579 to your computer and use it in GitHub Desktop.
Save JustinJohnWilliams/5190579 to your computer and use it in GitHub Desktop.
<h2>Clients</h2>
<section>
<div id="alertClientCreated" class="alert alert-info" style="display: none;">
Appointment Time:
<input type="text" id="dateWidget" /><br />
<label id="dateWidgetValue" class="text-info"></label>
<button type="button" class="btn-info">Create Appointment!</button>
</div>
<a href="javascript:;" id="newClient">New Client</a>
<div class="modal hide" id="newClientModal">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal">[x]</button>
<h3>Create Client</h3>
</div>
<div class="modal-body">
<p>
<label>Pet's Name</label>
<input type="text" id="newClientFirstName" />
<label>Owner's Last Name</label>
<input type="text" id="newClientLastName" />
<label>Phone Number (e.g. 214.555.5555)</label>
<input type="text" id="newClientPhoneNumber" />
</p>
</div>
<div class="modal-footer">
<a href="javascript:;" class="btn" data-dismiss="modal">Close</a>
<a href="javascript:;" id="createClient" data-url="@Url.Action("Create", "Clients")" class="btn btn-primary">Save</a>
</div>
</div>
</section>
<div class="section">
<pre>
@foreach (var client in ViewBag.Clients)
{
@client
}
</pre>
</div>
<script type="text/javascript">
$(function () {
$('#newClient').click(function () {
$('#newClientModal').modal('show');
});
$('#createClient').click(function () {
var url = $(this).attr('data-url');
$.post(url, { FirstName: $('#newClientFirstName').val(), LastName: $('#newClientLastName').val(), PhoneNumber: $('#newClientPhoneNumber').val() }, function (data) {
$('#newClientModal').modal('hide');
$('#alertClientCreated').show();
});
});
});
</script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment