我有對象的列表:如何將對象列表傳遞給MVC4中的控制器方法?
var things = [];
var obj = {
ayah: line.ayah,
surah: line.surah,
verse: line.verse
};
things.push(obj);
$.ajax({
method: 'GET',
url: "Gateway/Inbound_Request_Handler?action=1",
data:things,
success: function (Data) {
var mera_obj = Data.key;
document.getElementById("Param2").value = '(' + mera_obj.Response_Code + ' , ' + mera_obj.Response_Description + ')';
},
error: function() {
alert("ERROR: can't connect to Server this time");
}
});
和類:
public class thing {
public int surah { get; set; }
public int ayah { get; set; }
public string verse { get; set; }
}
這裏是控制器方法:
public class GatewayController : Controller
{
[HttpGet]
public ActionResult Inbound_Request_Handler(List<thing> things)
{...}
}
,但它仍然顯示控制器方法列表爲空。我不知道我最近怎麼了?
請給我建議任何東西... – Marium