I'm creating an array of string dynamically and I want when click on sumbit button to send this array to the controller I created this array with jquery how to do that? is it possible to write in viewbag from vien thanks
1 Answer
[HttpPost]
public ActionResult Arrays(string[][] arrays)
{
// Do something with the arrays
return Json(new { status = "success" });
}
and to post:
var arrays = [{'0':'value1', '1':'value2'},
{'0':'value3', '1':'value4'},
{'0':'value5', '1':'value6'}];
$.post('/home/arrays', { arrays: arrays }, function(result) {
alert(result.status);
});
1 Comment
Yasminette
Thank you I will try it,just how to schedule the post when submiting