i'm hoping can this,
i'm having difficult time getting jqueryui's autocomplete work $.ajax({}) call in asp.net application.
can make ajax call, getting response service , list of locations.
but still autocomplete list not shown, when press down arrow key location list rendered on page.
should rendered/shown after getting list of locations web method. how possible?
i'm using autocomplete jquery site: http://jqueryui.com/demos/autocomplete/
sample code
function getcitieslikelist(objcity) { var cities = ""; $.ajax({ type: "post", url: http://localhost/testweb/location.asmx/getlocations, data: "{ city : '" + objcity + "'}", contenttype: "application/json; charset=utf-8", datatype: "json", success: function (msg) { if (msg.d != null && msg.d != "") { cities = ""; cities = msg.d; $("#citilist").autocomplete({ source: cities }); } else $("#citilist").attr("autocomplete", "off") }, error: function (xhr, ajaxoptions, thrownerror) { return false; } }); }
i found way trigger jquery ui autocomplete functionality, without typing box:
$('#field').autocomplete({ source: '/path/to/data', minlength: 0 }); $('#button').click(function() { $('#field').autocomplete('search', '') });
sending 'search' arg triggers search functionality. second argument "term" sent data handler @ /path/to/data.
Comments
Post a Comment