如何通过Json将复杂列表传递给Controller [英] how to pass Complex List to Controller through Json

查看:128
本文介绍了如何通过Json将复杂列表传递给Controller的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何通过Json将复杂列表传递给Controller



how to pass Complex List to Controller through Json

var objContactColletion=  [
  {"UserEntity":{"UID":"1","Name":"jhon"},
 { "ContactEntity":{"Cont_ID":"2","Contact_No":"Aron"}
];

   $.ajax({
      type: "POST",
      url: "ContactDetails",
      dataType: "json",
      data: { students: JSON.stringify(objContactColletion) },
      success: function (result) {
          alert('success');
      },
      error: function (result) {
          alert(result.responseText);
      }

  });

推荐答案

.ajax({
type: POST
url: ContactDetails
dataType: json
data:{students: JSON .stringify(objContactColletion)},
成功: function (结果){
alert(' success');
},
错误: function (结果){
alert(result.responseText);
}

});
.ajax({ type: "POST", url: "ContactDetails", dataType: "json", data: { students: JSON.stringify(objContactColletion) }, success: function (result) { alert('success'); }, error: function (result) { alert(result.responseText); } });


这篇关于如何通过Json将复杂列表传递给Controller的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆