How to get value/data of each element of ListReturn View as String in .NET CoreHow do I detect a click outside an element?How do I check if an element is hidden in jQuery?How do I remove a property from a JavaScript object?How do you get a timestamp in JavaScript?How do I check if an array includes an object in JavaScript?How to get the children of the $(this) selector?How do I correctly clone a JavaScript object?How can I get query string values in JavaScript?How to check if an object is an array?How do I remove a particular element from an array in JavaScript?

Could IPv6 make NAT / port numbers redundant?

Change TeXForm of ArcTan

Is American Express widely accepted in France?

Double integral bounds of integration polar change of coordinate

The oldest tradition stopped before it got back to him

Creating Fictional Slavic Place Names

Since Angular 8 uses @ViewChild, the new static option, how should I use it?

Singlequote and backslash

Rotated Position of Integers

When was the word "ambigu" first used with the sense of "meal with all items served at the same time"?

Can you use a concentration spell while using Mantle of Majesty?

Self-Preservation: How to DM NPCs that Love Living?

Where can I find the list of all tendons in the human body?

What does the behaviour of water on the skin of an aircraft in flight tell us?

Strange math syntax in old basic listing

What does it mean by "d-ism of Leibniz" and "dotage of Newton" in simple English?

Term for checking piece whose opponent daren't capture it

California: "For quality assurance, this phone call is being recorded"

Humans meet a distant alien species. How do they standardize? - Units of Measure

Explain Ant-Man's "not it" scene from Avengers: Endgame

What is the intuition behind uniform continuity?

Scala list with same adjacent values

Are there regional foods in Westeros?

Asking bank to reduce APR instead of increasing credit limit



How to get value/data of each element of List


Return View as String in .NET CoreHow do I detect a click outside an element?How do I check if an element is hidden in jQuery?How do I remove a property from a JavaScript object?How do you get a timestamp in JavaScript?How do I check if an array includes an object in JavaScript?How to get the children of the $(this) selector?How do I correctly clone a JavaScript object?How can I get query string values in JavaScript?How to check if an object is an array?How do I remove a particular element from an array in JavaScript?






.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty height:90px;width:728px;box-sizing:border-box;








0















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










share|improve this question



















  • 1





    Loop over the actions array. Don't use alert for debugging. Log to console and you will see exactly what you are working with

    – charlietfl
    Mar 24 at 11:09












  • Do not return List<ActionResult> from action. Return ActionResult and at the end of method call return Json(collection). In js browse object properties

    – Alexander
    Mar 24 at 11:10











  • After change on Json(collection) result is the same - undefined value

    – Kapker
    Mar 24 at 11:50











  • Maybe there's no document key in index 1? Does actions.forEach(action => console.dir(action);) gives you any results?

    – eyecatchUp
    Mar 24 at 12:25











  • I tried foreach loop and for every elements of list I get Object in console, but I want to get value this Object (html code)

    – Kapker
    Mar 24 at 12:30


















0















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










share|improve this question



















  • 1





    Loop over the actions array. Don't use alert for debugging. Log to console and you will see exactly what you are working with

    – charlietfl
    Mar 24 at 11:09












  • Do not return List<ActionResult> from action. Return ActionResult and at the end of method call return Json(collection). In js browse object properties

    – Alexander
    Mar 24 at 11:10











  • After change on Json(collection) result is the same - undefined value

    – Kapker
    Mar 24 at 11:50











  • Maybe there's no document key in index 1? Does actions.forEach(action => console.dir(action);) gives you any results?

    – eyecatchUp
    Mar 24 at 12:25











  • I tried foreach loop and for every elements of list I get Object in console, but I want to get value this Object (html code)

    – Kapker
    Mar 24 at 12:30














0












0








0


1






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










share|improve this question
















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







javascript jquery asp.net-core






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Mar 24 at 18:02







Kapker

















asked Mar 24 at 11:05









KapkerKapker

34




34







  • 1





    Loop over the actions array. Don't use alert for debugging. Log to console and you will see exactly what you are working with

    – charlietfl
    Mar 24 at 11:09












  • Do not return List<ActionResult> from action. Return ActionResult and at the end of method call return Json(collection). In js browse object properties

    – Alexander
    Mar 24 at 11:10











  • After change on Json(collection) result is the same - undefined value

    – Kapker
    Mar 24 at 11:50











  • Maybe there's no document key in index 1? Does actions.forEach(action => console.dir(action);) gives you any results?

    – eyecatchUp
    Mar 24 at 12:25











  • I tried foreach loop and for every elements of list I get Object in console, but I want to get value this Object (html code)

    – Kapker
    Mar 24 at 12:30













  • 1





    Loop over the actions array. Don't use alert for debugging. Log to console and you will see exactly what you are working with

    – charlietfl
    Mar 24 at 11:09












  • Do not return List<ActionResult> from action. Return ActionResult and at the end of method call return Json(collection). In js browse object properties

    – Alexander
    Mar 24 at 11:10











  • After change on Json(collection) result is the same - undefined value

    – Kapker
    Mar 24 at 11:50











  • Maybe there's no document key in index 1? Does actions.forEach(action => console.dir(action);) gives you any results?

    – eyecatchUp
    Mar 24 at 12:25











  • I tried foreach loop and for every elements of list I get Object in console, but I want to get value this Object (html code)

    – Kapker
    Mar 24 at 12:30








1




1





Loop over the actions array. Don't use alert for debugging. Log to console and you will see exactly what you are working with

– charlietfl
Mar 24 at 11:09






Loop over the actions array. Don't use alert for debugging. Log to console and you will see exactly what you are working with

– charlietfl
Mar 24 at 11:09














Do not return List<ActionResult> from action. Return ActionResult and at the end of method call return Json(collection). In js browse object properties

– Alexander
Mar 24 at 11:10





Do not return List<ActionResult> from action. Return ActionResult and at the end of method call return Json(collection). In js browse object properties

– Alexander
Mar 24 at 11:10













After change on Json(collection) result is the same - undefined value

– Kapker
Mar 24 at 11:50





After change on Json(collection) result is the same - undefined value

– Kapker
Mar 24 at 11:50













Maybe there's no document key in index 1? Does actions.forEach(action => console.dir(action);) gives you any results?

– eyecatchUp
Mar 24 at 12:25





Maybe there's no document key in index 1? Does actions.forEach(action => console.dir(action);) gives you any results?

– eyecatchUp
Mar 24 at 12:25













I tried foreach loop and for every elements of list I get Object in console, but I want to get value this Object (html code)

– Kapker
Mar 24 at 12:30






I tried foreach loop and for every elements of list I get Object in console, but I want to get value this Object (html code)

– Kapker
Mar 24 at 12:30













1 Answer
1






active

oldest

votes


















0














In jQuery you can iterate through the Values like this



<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
$.each(function() // <-- iterates through each object in actions array
console.log($(this)); // <-- logs the object to the console
);
console.log(actions[1]); // <-- return a single object
console.log(actions[1].document) // <-- value undefined
);
);
</script>


In most browsers even console.log(actions); would work. But you can always JSON.stringify(actions);






share|improve this answer























    Your Answer






    StackExchange.ifUsing("editor", function ()
    StackExchange.using("externalEditor", function ()
    StackExchange.using("snippets", function ()
    StackExchange.snippets.init();
    );
    );
    , "code-snippets");

    StackExchange.ready(function()
    var channelOptions =
    tags: "".split(" "),
    id: "1"
    ;
    initTagRenderer("".split(" "), "".split(" "), channelOptions);

    StackExchange.using("externalEditor", function()
    // Have to fire editor after snippets, if snippets enabled
    if (StackExchange.settings.snippets.snippetsEnabled)
    StackExchange.using("snippets", function()
    createEditor();
    );

    else
    createEditor();

    );

    function createEditor()
    StackExchange.prepareEditor(
    heartbeatType: 'answer',
    autoActivateHeartbeat: false,
    convertImagesToLinks: true,
    noModals: true,
    showLowRepImageUploadWarning: true,
    reputationToPostImages: 10,
    bindNavPrevention: true,
    postfix: "",
    imageUploader:
    brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
    contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
    allowUrls: true
    ,
    onDemand: true,
    discardSelector: ".discard-answer"
    ,immediatelyShowMarkdownHelp:true
    );



    );













    draft saved

    draft discarded


















    StackExchange.ready(
    function ()
    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55323143%2fhow-to-get-value-data-of-each-element-of-listobject%23new-answer', 'question_page');

    );

    Post as a guest















    Required, but never shown

























    1 Answer
    1






    active

    oldest

    votes








    1 Answer
    1






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes









    0














    In jQuery you can iterate through the Values like this



    <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
    $.each(function() // <-- iterates through each object in actions array
    console.log($(this)); // <-- logs the object to the console
    );
    console.log(actions[1]); // <-- return a single object
    console.log(actions[1].document) // <-- value undefined
    );
    );
    </script>


    In most browsers even console.log(actions); would work. But you can always JSON.stringify(actions);






    share|improve this answer



























      0














      In jQuery you can iterate through the Values like this



      <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
      $.each(function() // <-- iterates through each object in actions array
      console.log($(this)); // <-- logs the object to the console
      );
      console.log(actions[1]); // <-- return a single object
      console.log(actions[1].document) // <-- value undefined
      );
      );
      </script>


      In most browsers even console.log(actions); would work. But you can always JSON.stringify(actions);






      share|improve this answer

























        0












        0








        0







        In jQuery you can iterate through the Values like this



        <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
        $.each(function() // <-- iterates through each object in actions array
        console.log($(this)); // <-- logs the object to the console
        );
        console.log(actions[1]); // <-- return a single object
        console.log(actions[1].document) // <-- value undefined
        );
        );
        </script>


        In most browsers even console.log(actions); would work. But you can always JSON.stringify(actions);






        share|improve this answer













        In jQuery you can iterate through the Values like this



        <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
        $.each(function() // <-- iterates through each object in actions array
        console.log($(this)); // <-- logs the object to the console
        );
        console.log(actions[1]); // <-- return a single object
        console.log(actions[1].document) // <-- value undefined
        );
        );
        </script>


        In most browsers even console.log(actions); would work. But you can always JSON.stringify(actions);







        share|improve this answer












        share|improve this answer



        share|improve this answer










        answered Mar 24 at 17:07









        Marius SteinbachMarius Steinbach

        78113




        78113





























            draft saved

            draft discarded
















































            Thanks for contributing an answer to Stack Overflow!


            • Please be sure to answer the question. Provide details and share your research!

            But avoid


            • Asking for help, clarification, or responding to other answers.

            • Making statements based on opinion; back them up with references or personal experience.

            To learn more, see our tips on writing great answers.




            draft saved


            draft discarded














            StackExchange.ready(
            function ()
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55323143%2fhow-to-get-value-data-of-each-element-of-listobject%23new-answer', 'question_page');

            );

            Post as a guest















            Required, but never shown





















































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown

































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown







            Popular posts from this blog

            Kamusi Yaliyomo Aina za kamusi | Muundo wa kamusi | Faida za kamusi | Dhima ya picha katika kamusi | Marejeo | Tazama pia | Viungo vya nje | UrambazajiKuhusu kamusiGo-SwahiliWiki-KamusiKamusi ya Kiswahili na Kiingerezakuihariri na kuongeza habari

            SQL error code 1064 with creating Laravel foreign keysForeign key constraints: When to use ON UPDATE and ON DELETEDropping column with foreign key Laravel error: General error: 1025 Error on renameLaravel SQL Can't create tableLaravel Migration foreign key errorLaravel php artisan migrate:refresh giving a syntax errorSQLSTATE[42S01]: Base table or view already exists or Base table or view already exists: 1050 Tableerror in migrating laravel file to xampp serverSyntax error or access violation: 1064:syntax to use near 'unsigned not null, modelName varchar(191) not null, title varchar(191) not nLaravel cannot create new table field in mysqlLaravel 5.7:Last migration creates table but is not registered in the migration table

            은진 송씨 목차 역사 본관 분파 인물 조선 왕실과의 인척 관계 집성촌 항렬자 인구 같이 보기 각주 둘러보기 메뉴은진 송씨세종실록 149권, 지리지 충청도 공주목 은진현