Skip to content Skip to sidebar Skip to footer

AJAX Call Is Only Sending Last Item, And Not Entire Array

This is my AJAX call : $('.all_of_union').live('click', function(){ id = window.location.href.split('/')[5] var data = {}; data.value = $('.union input').map(funct

Solution 1:

You could try this

traditional: true

EDIT:

I tried your example and got it to work. Here is the script:

  $.ajax({
    type: "POST",
    url: "/home/test/" + 4,
    dataType: "script",
    traditional: true,
    data: { value: ['1', '2'] }
  });

And here is the method

[HttpPost]
public ActionResult Test(string id, string[] value)
{
  return RedirectToAction("Index");
}

I get two values in array "value"


Post a Comment for "AJAX Call Is Only Sending Last Item, And Not Entire Array"