嘿伙计们我写了一些javascript代码,现在我想从.cshtml文件中删除它并将其存储在自己的.js文件中。但是我不知道如何重新调用它。现在,在.cshtml文件中完美地运行的代码就是这个
<script type="text/javascript">
$(document).ready(function () {
$('.deletebutton2').click(function () {
var ParamVal = event.target.id;
var JQajaxurl = $("#ajaxurl").text();
$('#popup').attr('title', 'Confirm Delete').text('Are you sure you want to Delete?').dialog({
buttons: {
'Delete': function () {
$.ajax({
type: 'POST',
url: JQajaxurl + ParamVal,
success: function (data) {
if (window.location.href.indexOf("Detail") > 0) {
parent.history.back();
return false;
}
else {
location.reload();
}
},
error: function (request, status, error) {
alert(request.responseText);
alert(textStatus);
alert(errorThrow);
}
});
},
'Cancel': function () { $(this).dialog('close') }
},
closeOnEscape: true, draggable: false, resizable: false, show: 'fade', modal: true, position: 'center'
});
$(".ui-dialog-titlebar-close").remove();
});
});
</script>