0

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 1

1
[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);        
});
Sign up to request clarification or add additional context in comments.

1 Comment

Thank you I will try it,just how to schedule the post when submiting

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.