asp.net mvc - Jquery UI Autocomplete how to send multiple values to serverside? -


i using jquery ui autocomplete , wondering how send multiple values back.

i tried

$('#id').autocomplete             ({                 source: 'myurl',                 minlength: 2,                 extraparams: { id: 1 }             }); 

this not seem work. option auto complete

edit

i have this

$('#id').autocomplete({                       source: function (request, response)                 {                     $.ajax({                         url: 'url',                         data: {                             term: request.term,                             id: 1                         },                         success: function (data)                         {                             response(data);                         }                      });                 },                 minlength: 2             }); 

my controller

 return json("test",jsonrequestbehavior.allowget); 

i tried

 return content("test"); 

however 't', 'e', 's', 't' instead of "test" splitting reason.

you're close; autocomplete widget expects array of candidates back:

this data should filtered based on provided term, , can in of formats described above simple local data (string-array or object-array label/value/both properties)

return json(new[] {"test"}, jsonrequestbehavior.allowget) 

Comments

Popular posts from this blog

php - What is the difference between $_SERVER['PATH_INFO'] and $_SERVER['ORIG_PATH_INFO']? -

fortran - Function return type mismatch -

queue - mq_receive: message too long -