jquery-ui-autocomplete

How to make another ajax call upon selection of autocomplete text field value in ASP.NET MVC 4?

喜欢而已 提交于 2019-11-29 12:54:26
I have an autocomplete text field, that uses JSON like so: $(function () { var src = '@Url.Action("GetParts", "Parts")' $("#autoCompleteBox").autocomplete({ source: function (request, response) { $.ajax({ url: src, async: true, dataType: "json", data: { partNumber: $("#autoCompleteBox").val() }, success: function (data) { response(data[0]); } }); } }); }); What I want to do is when the user selects the item from the suggested list is make another ajax call to get specific information about that item and populate other textboxes on the page. What is the best approach for this? You can do that

Javascript Autocomplete email's domain using jQuery UI

不问归期 提交于 2019-11-29 12:14:39
I need help, I am stuck with trying to make the following case scenario work: You have email input field, you type: foo@y - it should pop up autocomplete box, offering yahoo.com (for example). If you take this suggestion, the end value should become: foo@yahoo.com I have wrote this code (modified off another jquery UI sample): $( "#tags" ) // don't navigate away from the field on tab when selecting an item .bind( "keydown", function( event ) { if ( event.keyCode === $.ui.keyCode.TAB && $( this ).data( "autocomplete" ).menu.active ) { event.preventDefault(); } }) .autocomplete({ minLength: 3,

jQuery UI autocomplete with JSON from URL

試著忘記壹切 提交于 2019-11-29 10:16:43
I'm using the jQuery UI Autocomplete function. I can make it work with the example provided with jQuery UI like this: var availableTags = [ "ActionScript", "AppleScript", "Asp", "BASIC", "C", "C++", "Clojure", "COBOL", "ColdFusion", "Erlang", "Fortran", "Groovy", "Haskell", "Java", "JavaScript", "Lisp", "Perl", "PHP", "Python", "Ruby", "Scala", "Scheme" ]; $("#tags").autocomplete({ source: availableTags }); This works without any problems. But I need to use JSON as my data source who can be retrieved like this: http://mysite.local/services/suggest.ashx?query=ball If I'm going to that URL I get

Can the default “Term” name passed in the “jquery UI autocomplete” feature be changed?

 ̄綄美尐妖づ 提交于 2019-11-29 10:03:15
问题 I am trying to change the "term" field that is set to that by default with the jquery ui autocomplete feature. Is it possibly to easily change it to "q" (query) without going and changing it in the "core" file? JavaScript: <script> $(function() { $( "#spotify_song_search" ).autocomplete({ source: "http://ws.spotify.com/search/1/track.json", data: { q: request.term }, dataType: "getjson", minLength: 3, select: function( event, ui ) { alert('select'); } }); }); </script> 回答1: Yes, it's possible

Select first jquery UI result automatically

こ雲淡風輕ζ 提交于 2019-11-29 09:13:36
I am using jQuery Autocomplete to search a local database of cities. Here is the code: $('#txt_search_city').autocomplete({ source: url, delay: 0, autoFocus: true, select: function( event, ui ) { $( "#id_city" ).val( ui.item.id ); $(this).closest('form').submit(); }, focus: function( event, ui ) { event.preventDefault(); } }); I'd like the first returned value to be selected by default (like it works on facebook). So essentially, if they just hit enter they will trigger the selection of the first result. I thought that's what autoFocus: true did, but it isn't working. Not showing errors, just

Not sure how to use the JQuery UI Autocomplete … :(

こ雲淡風輕ζ 提交于 2019-11-29 09:00:44
this is a continuation from a previous JQueryUI Autocomplete question, I asked . This time, I have my data returning ... but I have no idea how i define what html to show and how to dynamically update that html with my results. So, here's my jquery .... Home.js function AutoComplete(element) { var cache = {}; $(element).autocomplete({ minLength: 2, source: function (request, response) { if (request.term in cache) { response(cache[request.term]); return; } else { $.getJSON("/api/autocomplete/" + encodeURIComponent(request.term), function (data) { cache[request.term] = data; response(data); });

jQuery - Use key/value pair in autocomplete

烂漫一生 提交于 2019-11-29 07:22:43
In my ASP MVC view, I am passing a key/value pair back from the controller. After looking at fiddler and viewing in Chrome's debugger I can see that the information is being passed back correctly. I would like for the value of the key/value pair to be the item that is displayed in the autocomplete list. When the user selects an item from the list, I would like that item's key to be placed into the text box. Here is the jQuery code from my view $(function () { $('#DRMCompanyId').autocomplete({ source: '@Url.Action("compSearch", "AgentTransmission")', minLength: 2, select: function (event, ui) {

JQuery autocomplete how to write label in autocomplete text input?

霸气de小男生 提交于 2019-11-29 07:09:59
Hello I am using jQuery UI autocomplete. I am getting values and labels from the drop down area. I will write the value in a hidden input and use it later. I could do that, but I cannot write the label in the search input, after the select item. When I select a row in the dropdown box, the value of the row is displayed in the search area (#tags), but I want the label in there. Here is my code: Thanks <html> <head> <script> $(document).ready(function () { var selectedLabel = null; var yerler = [ { "value": 3, "label": "Adana Seyhan" }, { "value": 78, "label": "Seyhan Adana" }, { "value": 17,

Sort the values in the jQuery Autocomplete

一个人想着一个人 提交于 2019-11-29 07:03:36
I have an array like ["JOAQUIN", "BERNARDINO", "MODOC","ALASKA","MADERA", "ANDERSON"] where I'm populating them in a jQuery UI Autocomplete . However the order of sorting seems to be weird. For example: (But I have more no.of records) When I type "a" it returns JOAQUIN BERNARDINO ALASKA MADERA ANDERSON What I'm trying is to get ( starting with ) ALASKA ANDERSON JSFiddle for my example Is it possible? Can someone point me in a right direction. Updates: var myarray= ["JOAQUIN", "BERNARDINO", "MODOC","ALASKA","MADERA", "ANDERSON"] myarray.sort(); Read More See Demo we are passing two arguments

Jquery UI autocomplete - images IN the results overlay, not outside like the demo

风流意气都作罢 提交于 2019-11-29 04:52:30
I have jQueryUI code for autocompleting that follows.... $(function() { var updates = [ { value: "URL", label: "some text", icon: "jqueryui_32x32.png"}; ]; $("input#autocomplete").autocomplete({ delay: 10, minLength: 0, source: updates, select: function( event, ui ) { window.location.href = ui.item.value; } }); }); And it essentially produces a site search where the results are direct links. I would like to add images that are stored locally to the results to greater imitate facebook. I've had no luck and seen questions before directing users to the "custom data" demo. Here is one such