所以,我想表明删除从我的表中的一行时弹出,所以这是我的动作链接:如何在mvc 4中创建弹出窗口?
<script src="@Url.Content("~/Scripts/jquery.unobtrusive-ajax.js")" type="text/javascript"></script>
<script src="@Url.Content("~/Scripts/jquery.validate.unobtrusive.js")" type="text/javascript"></script>
<script src="@Url.Content("~/Scripts/jquery-ui-1.8.20.min.js")" type="text/javascript"></script>
@Html.ActionLink("Delete", "Delete", new { id=item.cin },new { @class = "delete-logo" ,@pkNo=item.cin})
<div id="confirmDialog" title="Warning"></div>
我的脚本:
<script type="text/javascript">
$(document).ready(function() {
buttonizeALL();
setLinks();
});
function buttonizeALL()
{
$(".delete-logo").button();
}
function setLinks()
{
//delete person
$(document).ready(function() {
$(".delete-logo").live("click", function (e) {
e.preventDefault();
var pkNo = $(this).attr("pkNo");
$("#confirmDialog").dialog({
resizable: false,
height: 200,
width: 300,
modal: true,
buttons: {
"Yes": function() {
$(this).dialog("close");
var rowNo = '#row-' + pkNo;
var url = '/Subscribers/Delete/' + pkNo;
$.ajax({
type: "Delete",
url: url,
data: {},
cache: false,
dataType: "json",
success: function() {
$(rowNo).animate({ opacity: 0.0 }, 400, function() {
$(rowNo).remove();
});
},
error: function (jqXHR, exception) {
alert('Uncaught Error.\n' + jqXHR.responseText);
}
}); //end ajax call
}, // end of yes button
"No": function() {
$(this).dialog("close");
}
} //end buttons
}); //end modal
}); //end delete
});
} //end setLinks
我的问题是弹出不起作用,当我用我的脚本没有弹出它的作品,所以请如果有人有任何想法,我将非常感激。
我想代码行'new {id =“ed”}'应该像这样'new {@id =“ed”}' – 2013-04-28 14:18:16
试试这个'@ Html.ActionLink(“Delete”,“Delete” ,new {@id =“ed”,@class =“delete-logo”,@pkNo =“ed”})' – 2013-04-28 14:27:01