0

I've read all the post of the similar topic and tried all the code suggestions, but still cannot get my autocomplete to work with a json file. The page loads with the input box, but nothing autocompletes.

I have tried to go back to basics to figure this thing out. Starting with the code below - what do I need to do with source in order to get it to read the following large json data file and only autocomplete the product "name" (second key:value)?

 <script src="//code.jquery.com/jquery-1.12.4.js"></script>
 <script src="//code.jquery.com/ui/1.12.1/jquery-ui.js"></script>

<script>
``$( "#autocomplete" ).autocomplete({
  source: [ "c++", "java", "php", "coldfusion", "javascript", "asp", "ruby" ]
});
</script>
<link rel="stylesheet" href="//code.jquery.com/ui/1.12.1/themes/smoothness/jquery-ui.css">
 
<!doctype html>
<html lang="en">
<head>
  <meta charset="utf-8">
  <title>autocomplete demo</title>
  
</head>

<body>
 
<label for="autocomplete">Select a programming language: </label>
<input id="autocomplete">
 
</body>
</html>
Montana
  • 21
  • 1
  • 2
  • try adding a document.ready wrapper to the function. It may be firing before the page is fully loaded. https://learn.jquery.com/using-jquery-core/document-ready/ – JoeCrash Sep 08 '17 at 16:57
  • I definitely have tried that during my struggles to see if it would make a difference. There was no luck there. More specifically I am looking for the code that will occupy the source section that will parse the json in the link provided and return to me the values of the key based on the letters typed in the box. – Montana Sep 08 '17 at 18:00
  • I definitely have tried that during my struggles to see if it would make a difference. There was no luck there. More specifically I am looking for the code that will occupy the source section that will parse the json in the link provided and return to me the values of the key based on the letters typed in the box. Granted I started plugging other peoples code in that I thought would solve for the problem, but to no luck. So hoping for the simple answer from people who have implemented this: https://stackoverflow.com/questions/25396513/jquery-ui-autocomplete-with-external-json-file – Montana Sep 08 '17 at 18:08

0 Answers0