【发布时间】:2015-06-20 05:34:59
【问题描述】:
我正在从@Html.ActionLink 调用 jQuery 对话框,但我很困惑将操作参数传递给 jQuery 对话框。如何将 CommunicationLocation 和 CommunicationType 传递给 jQuery 对话框?
@Html.ActionLink("Delete", "DeleteEmail", null, new { CommunicationLocation
= commemail.CommunicationLocation, CommunicationType = "email" },
new { @class = "modalDialog btn btn-success" })
对话框分区
<div id="dialog-confirm" title="Delete the item?">
<p><span class="ui-icon ui-icon-alert" style="float:left; margin:0 7px 20px 0;"></span>This item will be deleted. Are you sure?</p>
</div>
JS
<script type="text/javascript">
$(document).ready(function () {
$("#dialog-confirm").dialog({
autoOpen: false,
modal: true,
resizable: false,
height: 180,
});
$('.modalDialog').click(function () {
$("#dialog-confirm").dialog({
buttons: {
"Confirm": function () {
$.ajax({
url: 'customer/DeleteEmail',
type: 'Post',
data: //Need to pass parameters here,
success: function (result) {
$('#DivEmailContainer').html(result);
}
});
$(this).dialog('close');
},
"Cancel": function () {
$(this).dialog("close");
}
}
});
$("#dialog-confirm").dialog("open");
return false;
});
</script>
控制器
[HttpPost]
public PartialViewResult DeleteEmail(string CommunicationLocation, string CommunicationType)
{
//Code here
}
【问题讨论】:
标签: javascript c# jquery asp.net-mvc asp.net-mvc-4