How to get value of Object from List in jQuery? Ath the moment I'm getting List of ActionResults from controller and I want to get value of each action (html code).
There is't a problem when I try to send single ActionResult - without list.
When I try to send List<ActionResult>
I get object Object
every time.
<script type="text/javascript">
$(document).on('click', 'button', function () {
$cartAction = $("#" + this.id);
var url = $cartAction.data("url");
$.get(url, function (actions) {
console.log(actions); <-- return Objects Array
console.log(???); <-- how to get value of each actions
console.log(actions[1]); <-- return a single object
console.log(actions[1].document) <-- value undefined
});
});
</script>
public ActionResult Index()
{
var actionList = new List<ActionResult>()
{
// ViewComponents, PartialViews
};
return Json(actionList);
}
I expect return html code for each ActionResult, but I get
[object Object],[object Object]
for actions list.
Edit: Answer on my question is here stackoverflow.com/a/53639387/10338470