Sending large number of data in JSON form RRS feed

  • Question

  • User1037983650 posted

    Hello Developers, 

     I am working on Asp.Net MVC application and I have incorporated JSON term in this.  There is a form which is having 50 text boxes and I need to send value of all those text boxes to a controller in the form of JSON. In a nutshell, I need to send entire form a view to a controller using AJAX so that I may extract a  value of a specific control by using Key ( Name attricute) .

    Could you please let me know how can I accomplish that?

    Looking forward to hear asap.

    Best Regards,


    Tuesday, April 28, 2015 3:57 PM

All replies

  • User61956409 posted

    Hi Sukhdeep,

    Thanks for your post.

    Please refer to the following sample to store the text of TextBoxes in JSON array.

        $(function () {
            $("#btngetjson").click(function () {
                var jsonarray = [];
                $("input[type='text']").each(function () {
                    var keyname = $(this).attr("name");
                    var val = $(this).val();
                    var item = '{"' + keyname + '":"' + val + '"}';

    Best Regards,

    Fei Han

    Tuesday, April 28, 2015 11:17 PM
  • User1037983650 posted

    Hello Fei,

    Thanks for writing back and assisting me. How can we do same if there are variety of controls? I mean what if all are not text boxes ? Some of them are drop downs ,checkboxes ,radio buttons , text boxes and so on .  What would be the possible solution for that ?

    Best Regards,


    Wednesday, April 29, 2015 2:15 AM