Created
August 29, 2012 12:50
-
-
Save jchannon/3512019 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$(document).ready(function () { | |
$('.btnDelete').live("click", function() | |
{ | |
var id = parseInt(this.id.substring(4)); | |
$.ajax({ | |
url: '/myurl'+id, | |
type: 'DELETE', | |
success: function(result) { | |
// Do something with the result | |
} | |
}); | |
}); | |
}); | |
<table id="posts"> | |
<thead> | |
<tr> | |
<th>ID</th> | |
<th>Title</th> | |
<th>Date Created</th> | |
<th>Published</th> | |
</tr> | |
</thead> | |
<tbody> | |
@foreach(var item in Model) | |
{ | |
<tr> | |
<td><a href="/@item.Id">Edit</a>|<a href="/@item.Id" class="btnDelete" id="[email protected]">Delete</a></td> | |
<td>@item.Title</td> | |
<td>@item.DateCreated</td> | |
<td> | |
@{ | |
if (item.Published) | |
<input type="checkbox" disabled="disabled" checked="checked" /> | |
else | |
<input type="checkbox" disabled="disabled"/> | |
} | |
</td> | |
</tr> | |
} | |
</tbody> | |
</table> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment