所以,我想表明刪除從我的表中的一行時彈出,所以這是我的動作鏈接:如何在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