asp.net mvc3 return multiple json list

Posted by Acid on Stack Overflow See other posts from Stack Overflow or by Acid
Published on 2012-06-03T10:35:38Z Indexed on 2012/06/03 10:40 UTC
Read the original article Hit count: 249

Filed under:
|
|
|

Im asp.net mvc3 c# code returns json list like this:

return Json(new { name = UserNames, imageUrl = ImageUrls });

UserNames and ImageUrls are both List types

And this is my jquery

function StartSearch(text) {
    $.ajax({
        url: '/Shared/Search',
        type: 'POST',
        data: { SearchText: text },
        dataType: 'json',
        success: function (result) {
            $.each(result, function (i, item) {

                alert(result[i].name);
            });
        }
    });
}

How i can get names and umageUrls?

Thanks

© Stack Overflow or respective owner

Related posts about c#

Related posts about jQuery