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

Winapi c++: DialogBox hangs when breaking a loop -

vb.net - Font adding using PDFsharp -

javascript - jQuery iScroll clickable list elements while retaining scroll? -