json - Autocomplete textbox using jQuery and ASP.NET Razor Syntax procedurally -


i trying create autocomplete function retrieves matching dvd titles database (dvd table). using asp.net razor syntax (not using mvc). have attempted this, no success. appreciate help. here have:

html

<input type="text" id="dvdtitles" class="custom-field"/> 

jquery

$('#dvdtitles').autocomplete({             source: function (query, process) {                 $.ajax({                     url: 'getdvdtitles.cshtml',                     type: 'post',                     data: 'term=' + term,                     datatype: 'json',                     async: true,                     success: function(data) {                         process(data)                     }                 });             }            }); 

asp.net razor (getdvdtitles.cshtml)

@{ var database = database.open("sqlserverconnectionstring"); var term = request.form["term"]; var sqlquery = "select * dvd dvd_title '%"+term+"%'";  var output  = database.query(sqlquery);  json.write(output); } 


Comments

Popular posts from this blog

c++ - Function signature as a function template parameter -

algorithm - What are some ways to combine a number of (potentially incompatible) sorted sub-sets of a total set into a (partial) ordering of the total set? -

How to call a javascript function after the page loads with a chrome extension? -