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

Perl - how to grep a block of text from a file -

delphi - How to remove all the grips on a coolbar if I have several coolbands? -

javascript - Animating array of divs; only the final element is modified -