<script type="text/javascript">
$(function() {
// attach the link event handler
$(this).find("a").click(function() {
var id = $(this).attr("id");
$("#addSuccess").hide();
if (name!=""&&name!="undefined") {
if (name == "True") {
$("#addSuccess").toggle(1000);
} else {
$("#addSuccess").hide();
}
}
$(".link-delete").click(function () {
var id = $(this).attr("data-id");
$("#deleteConfirm").attr("data-id", id);
$("#modal-delete").modal("show");
});
$("#deleteConfirm").click(function () {
var id = $(this).attr("data-id");
deleteSchoolTerm(id);
});
function deleteSchoolTerm(id){
var url = "@Url.Action("DeleteSchoolTerm")";
$.ajax({
url: url,
type: "POST",
dataType: "json",
data: JSON.stringify({ id: id }),
contentType: "application/json",
error: function (jqXHR, textStatus, errorThrown) {
var errorMsg = JSON.parse(jqXHR.responseText);
$("#result").html(msgHelper.alarm("Error", errorMsg.Message));
$("#result").show("slow");
},
success: function () {
location.replace("@Url.Action("Index")");
}
});
}