I am using Coldfusion 9 and Sql Server 2008 r2. I am trying to use this live search which displays results.
Original Post is : http://www.raymondcamden.com/index.cfm/2011/2/1/Using-jQuery-to-search-against-different-types-of-content
I want to add a table to this, so I can get it to format. Any help will be great.
This is the Search.cfm
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js"></script>
<script>
$(document).ready(function() {
//http://stackoverflow.com/questions/217957/how-to-print-debug-messages-in-the-google-chrome-javascript-console/2757552#2757552
if (!window.console) console = {};
console.log = console.log || function(){};
console.dir = console.dir || function(){};
//listen for keyup on the field
$("#searchField").keyup(function() {
//get and trim the value
var field = $(this).val();
field = $.trim(field)
//if blank, nuke results and leave early
if(field == "") {
$("#results").html("");
return;
}
console.log("searching for "+field);
$.getJSON("test.cfc?returnformat=json&method=search", {"search":field}, function(res,code) {
var s = "";
s += "<h2>Results</h2>";
for(var i=0; i<res.fd_table.length; i++) {
s += "<p><b>uid:"+res.fd_table[i].fd_uid+"</b><br/>Device: "+res.fd_table[i].fd_dev + "<br/>";
}
$("#results").html(s);
});
});
})
<form>
Search: <input type="text" name="search" id="searchField">
</form>
<div id="results"></div>
Demo From the original post http://www.coldfusionjedi.com/demos/feb12011/test.cfm
This is the end result I am trying to achieve.
..