我有两个参数的服务器mvc操作:
[HttpPost]
public ActionResult TestActionPost(string applicationId, Dictionary<string, int> myDictionary)
{
return null;
}
和ajax请求:
<script type="text/javascript">
$(document).ready(function () {
$("#itemList").tableDnD({
onDrop: function (table, row) {
var items = $("table#itemList > tbody > tr[id]");
var dict = [];
var dataObject = [];
$.each(items, function (index, value) {
dict.push({
key: value.id,
value: index
});
});
dataObject.push("123");
dataObject.push(dict);
$.ajax({
url: "/Admin/Applications/TestActionPost/",
type: "POST",
contentType: "application/json; charset=utf-8",
data: { applicationId: JSON.stringify(dataObject[0]), myDictionary : JSON.stringify(dataObject[1]) },
traditional: true,
dataType: "json",
success: function (response) {
alert(response);
}
});
}
});
});
</script>
我尝试将数据发送到服务器操作,但我的操作无法调用。我得到代码HTTP 500。 拜托,帮助我!