简体   繁体   中英

Passing Data from JQuery To MVC3 Controller

i have a requirement where am doing search based on the users input and users can dynamically add the search row

<tr id="tblNewContentRow">
<td>
@Html.TextBox("txtNewAttributes", "", new { @class = "alphaonly", style = "width: 155px;" })
</td>
<td>
@{@Html.DropDownList("ddlNewValues", Model.OperandsMaxList, new { style = "height: 20px;" })
}
</td>
<td colspan="2">
@Html.TextBox("txtNewValues", "", new { @class = "numbersonly", style = "width: 250px;" })
 </td>
</tr>

and ADD button generates the similar row below this row dynamically(i used Jquery) as much rows as user wants.

When the user hits submit i want to query this attributes(textbox,dropdown,textbox) for list in Database. i can pass this data using the Ajax call.

My question is how to send those multiple values in json to controller so ican easily map and retrieve values

var data=('#form_id').serializeArray();

Then send this ' data' as attribute and expect string[] type in controller. The whole data will be passed to the controller

Cheers PHANI*

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM