$(document).ready( function() {
$.ajaxSetup ({ async: true });
//Loading icon
var ajax_load = '
';
var dataColsArray = new Array();
var numRows = 0;
$("#resultCount").html(numRows + " results");
$(".ajax").click(function(){
var pageDisplayLimit = 10;
var dataColsArray = new Array();
var classAttrs = $(this).attr('class');
var tagNames = classAttrs.split(" ");
var tagName;
$(tagNames).each(function()
{
if(this.indexOf('-') >= 0)
{
//If button class has "-" in it, split it. We use the parts to determine where
//to display the results
//Exmaple:
var splitClass = this.split('-');
tagName = splitClass[1];
}
});
//The table should have the columns defined ahead of time, use that
//to generate the list of values we need from the JSON response.
var columnNames = "#" + tagName + " thead th";
$(columnNames).each( function() {
dataColsArray.push( $(this).attr("id") );
});
//While request and parsing is taking place, put loading messages in place
$("#resultCount-"+tagName).html("Searching...");
if ( $("#" + tagName + " tbody")) $("#" + tagName + " tbody").remove();
$("#" + tagName + " thead").after("