Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 187219
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T15:47:06+00:00 2026-05-11T15:47:06+00:00

I know this issue has been touched on before, e.g. here: How to post

  • 0

I know this issue has been touched on before, e.g. here:

How to post an array of complex objects with JSON, jQuery to ASP.NET MVC Controller?

But the solutions doesn’t seem to fit my problem.

Here is my HTML. The number of rows are variable:

 <table id='workPlanTable'>     <tr>         <th>             Begin         </th>         <th>             End         </th>     </tr>      <tr itemId='1'>         <td><input class='begin' id='begin_1' name='begin_1' type='text' value='5:30' /></td>         <td><input class='end' id='end_1' name='end_1' type='text' value='11:30' /></td>     </tr>     <tr itemId='3'>         <td><input class='begin' id='begin_3' name='begin_3' type='text' value='5:30' /></td>         <td><input class='end' id='end_3' name='end_3' type='text' value='7:30' /></td>     </tr>  </table> 

The JS builds an array of objects and posts them to a control method:

<script type='text/javascript'> $(function() {    submitForm = function() {     var items = new Array();     $('#workPlanTable tr').each(function(i) {       var end = $(this).find('.end').val();       var begin = $(this).find('.begin').val();       var item = {         'Begin': begin,         'End': end       };       items.push(item);      });     var postData = {       myItems: items     };      $.ajax({       url: '~/WorkPlan/AjaxUpdate',       type: 'POST',       dataType: 'json',       data: postData,       contentType: 'application/json; charset=utf-8',       success: function(result) {         alert(result.Result);       }     });   } }) </script> 

Each row represent a WorkPlanItem that.

My goal is to post them all to my controller to update them.

I can’t seem to figure out how to access the array in my controller method (AjaxUpdate).

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. 2026-05-11T15:47:06+00:00Added an answer on May 11, 2026 at 3:47 pm

    You can serialize the form as Vikas posted, or you could use a stringify function if you’d prefer to walk the page (as you are currently doing) and use the postData array.

    On the controller, you’ll need to handle the json string. You can use the System.Web.Script.Serialization.JavaScriptSerializer class to deserialize it. If you have an object that maps to the data you’re passing, you can use the Deserialize method. If you don’t, you can still use DeserializeObject, however that gives you a Dictionary<string, string> collection that you’ll have to walk through to get your data. Not exactly fun (trust me), but it works.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I know this issue has been touched on here but I have not found
I know this has been asked multiple times here, but I've a different issue
I don't know if anyone has seen this issue before but I'm just stumped.
Update: This issue has been resolved. you can read about the solution in here:
I know this has been asked before but I have looked at every answer
I know that the Hudson vs. CC issue has been beaten (discussed) to death,
I know this issue being mentioned before, but resolutions there didn't apply. I'm having
First off I know this has been covered on SO. But the most popular
Hey most of my issue has been solved but i have little problem This
Ok, So i know this questions has been asked. and everything i read has

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.