MVC弹出Model。---确认删除
html
<scripttype="text/javascript">
$(document).ready(function () {
$(".link-delete").click(function () {
var id = $(this).attr("data-id");// get the school id, html 5 versoin: var id = $(this).data("id");
$("#deleteConfirm").attr("data-id", id); // set the id to the delete confirm link button
$("#modal-delete").modal("show");// show delete confirmation modal window
});
$("#deleteConfirm").click(function() {
var id = $(this).attr("data-id");
deleteSchoolTerm(id);
});
function deleteSchoolTerm(id) {
ajax---->to delete action
}
<ahref="#"class="link-delete"data-id="@Model.***">Delete</a>
<!-- modal window (delete confirmation) -->
<divid="modal-delete"class="modal hide fade">
<divclass="modal-header">
<buttontype="button"class="close"data-dismiss="modal"aria-hidden="true">×</button>
<h3>Delete</h3>
</div>
<divclass="modal-body">
<divid="result"style="display:none;"></div>
<p>You are about to delete the student.</p>
<p>Do you want to proceed?</p>
</div>
<divclass="modal-footer">
<ahref="#"class="btn btn-danger"id="deleteConfirm">Yes</a>
<buttonclass="btn"data-dismiss="modal"aria-hidden="true">No</button>
</div>
</div>