Note that there are some explanatory texts on larger screens.

plurals
  1. POHow do I use jquery's UI autocomplete with ASP.NET and an external data source?
    primarykey
    data
    text
    <p>I've been trying to put the pieces together on this for a while and am having trouble.</p> <p>The components:</p> <ul> <li>ASP.NET web application</li> <li>MS SQL database and tables</li> <li>C# class with get and set for all table columns</li> <li>jquery and jquery UI libraries</li> </ul> <p>The scenario:</p> <ul> <li>I have a textbox that I'd like to have autocompleted.</li> <li>Once the textbox is populated, the user clicks "Add" (Ideally, I need to return the ID of the item but I'm just trying to get it to work)</li> </ul> <p>What I'm not sure about is how the data populated. The jquery documentation says I should have a source URL. The following works fine.</p> <pre><code>&lt;script&gt; $(function () { var availableTags = [ "ActionScript", "AppleScript", ..... ..... "Ruby", "Scala", "Scheme" ]; $("#autoComplete").autocomplete({ source: availableTags }); }); &lt;/script&gt; </code></pre> <p></p> <p>But when I replace the array with with an external source it doesn't work:</p> <pre><code>&lt;script&gt; $(function () { $("#autoComplete").autocomplete({ source: "http://localhost:61639/ProjectName/AutoCompleteContent.htm" }); }); &lt;/script&gt; </code></pre> <p>And this is the HTML for AutoCompleteContent.htm</p> <pre><code>&lt;!DOCTYPE&gt; &lt;html xmlns="http://www.w3.org/1999/xhtml"&gt; &lt;head&gt; &lt;title&gt;&lt;/title&gt; &lt;/head&gt; &lt;body&gt; [ "ActionScript", "AppleScript", ..... ..... "Ruby", "Scala", "Scheme" ] &lt;/body&gt; &lt;/html&gt; </code></pre> <p>Here is my problem:</p> <ol> <li>I'm not sure what the data should look like on the page.</li> <li>I surely don't know how to display my DB data in a valid format for autocomplete to accept it.</li> </ol> <p>I think I'm going down the right path, but not sure. Could someone spell out the steps?</p> <p>I'm very appreciative!</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload