how to pass an array from a asp.net mvc controller action back to javascript using jquery / ajax

Posted by oo on Stack Overflow See other posts from Stack Overflow or by oo
Published on 2010-04-04T14:45:42Z Indexed on 2010/04/04 14:53 UTC
Read the original article Hit count: 148

Filed under:
|
|
|

Here is my jQuery code:

 $.get('/Home/GetList', function(data) {
             debugger;
             $('#myMultiSelect').val(values);
         });

Here is my controller code:

    public ActionResult GetList(int id)
    {
        int[] bodyParts = _repository.GetList(id);

       //how do i return this as an array back to javascript ??
    }

if I have the GetList function return an array of integers, how do I return this to the jQuery function?

© Stack Overflow or respective owner

Related posts about jQuery

Related posts about AJAX