asp.net mvc 3 - MVC Displaying JSON Objects -


i getting list of objects database

public class testcode {     /// <summary>     /// productid     /// </summary>     public int id { get; set; }      public string codename { get; set; }     public string manname { get; set; }     public string dosname { get; set; } } 

my controller converts them json using

 return json(formattedcodes); 

the controller called following ajax

 $(document).ready(function () {        $("#tags").autocomplete({            source: function (request, response) {                $.ajax(                {                    type: "post",                    url: '@url.action("getautotext3", "code")',                    datatype: "json",                    data: { code: $("#tags").val() },                    success: function (data) {                                                response($.map(data, function (c) {                                                    alert(c.manname);                                                    return c                                                }));                    }                })            }        })    }); 

previously returned json string , above code worked fine. still works fine input box isn't being populated autocomplete values, due fact objects returned , line "data: { code: $("#tags").val() }," no longer valid.

" alert(c.manname);" returns correct values objects there , correct.

i looking 'model' way of allocating data html, rather concatenating string together.

e.g autocomplete have manname , codename values displayed somehow store id behind scenes can use when autocomplete item selected.

any ideas?

thanks


Comments

Popular posts from this blog

blackberry 10 - how to add multiple markers on the google map just by url? -

php - guestbook returning database data to flash -

delphi - Dynamic file type icon -