0

let's assume I have controller method like this

public ActionResult GetSelected(int[] ids)
{
   //do something
   return Json (ids, JsonRequestBehavior.AllowGet)
}

and in view file I have function which creates array named list. How can I pass my array to controller using $.get function?

Lums
  • 67
  • 7

1 Answers1

0

I would do this :

   var data = { 1, 2 };
    $.ajax({
    url: '@Url.Action('GetSelected','ControllerName')',
    data: {
      getSelected : data
      },
       success:function(data){
      //Do Something With the return data or HttpStatusCode
      }
    });
Kevin B Burns
  • 1,032
  • 9
  • 24