如何通过getJson()将multipal参数传递给控制器 [英] how to pass multipal parameter to controller through getJson()
本文介绍了如何通过getJson()将multipal参数传递给控制器的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
你好朋友,
我想通过以下方式向控制器发送2个参数:
Hello friends,
I'm want to send 2 parameter to controller using following:
$(document).on('click', '#DataTable tfoot a', function (e) {
e.preventDefault();
var data = {
page: $(this).text()
,orderid: $('#txtOrderID').val()
};
$.getJSON("/Order/getOrderDetails", data, function (d) {
$('#DataTable').remove();
$('body').append(d.data);
var footer = createFooter(d.count);
});
});
数据持有
where data holds
1. page no<br />
2. orderid(Search criteria)
在控制器中
In controller
public JsonResult getOrderDetails(int? data)
{
.
.
.
}
当我调试时,数据总是得到页面号而不是orderid
我可以知道我哪里出错吗?
如何在控制器中同时获取两个参数?
提前致谢
when i debug, data is always getting page no and not orderid
May i know where i'm going wrong?
How can get both parameter in the controller??
Thanks in advance
推荐答案
(文件).on('click','#DataTable tfoot a',function(e){
e.preventDefault ();
var data = {
page:
(document).on('click', '#DataTable tfoot a', function (e) { e.preventDefault(); var data = { page:
(this).text()
,orderid:
(this).text() ,orderid:
('#txtOrderID')。val()
};
('#txtOrderID').val() };
这篇关于如何通过getJson()将multipal参数传递给控制器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文