Server Side Single Row Select and Passing ID out

Server Side Single Row Select and Passing ID out

ConnectionProblemConnectionProblem Posts: 3Questions: 0Answers: 0
edited November 2012 in General
I'm sorry for asking this question I have searched and read several posts on the subject. I have a working server side Datatables installation. I currently have a table of patients that I want to implement single row select and pass the patient ID into a variable so I can load the patient details page. I have tried using the select example, but the page fails to load. Below is my JS code.
[code]
var id = "<?php echo $id; ?>"
var oTable;
var gaiSelected = [];

$(document).ready(function() {
$('#form').submit( function() {
alert (gaiSelected);
return false;
} );

/* Init the table */
oTable = $("#example").dataTable({
"bProcessing": true,
"bServerSide": true,
"oLanguage": {"sInfoFiltered": ""},
"fnServerParams": function (aoData) { aoData.push({ "name": "doctor", "value": id }) },
"bAutoWidth": true,
"sAjaxSource": "php/patpro.php"
"fnRowCallback": function( nRow, aData, iDisplayIndex ) {
if ( jQuery.inArray(aData[0], gaiSelected) != -1 )
{
$(nRow).addClass('row_selected');
}
return nRow;
},
"aoColumns": [
{ "bVisible": 0 }, /* ID column */
null,
null,
null,
null,
null,
null,
null
]
});

/* Click event handler */
$('#example tbody tr').live('click', function () {
var aData = oTable.fnGetData( this );
var iId = aData[0];

if ( jQuery.inArray(iId, gaiSelected) == -1 )
{
gaiSelected[gaiSelected.length++] = iId;
}
else
{
gaiSelected = jQuery.grep(gaiSelected, function(value) {
return value != iId;
} );
}

$(this).toggleClass('row_selected');
} );[/code]

And the top part of my php code. [code]

$aColumns = array( 'p_id', 'name', 'address', 'city', 'state', 'cellno', 'dob');

/* Indexed column (used for fast and accurate table cardinality) */
$sIndexColumn = "p_id";

/* DB table to use */
$sTable = "patient";[/code]

Any help in pointing out where I went wrong and how to get a the patient ID out to a variable would be amazing.
Thank you
This discussion has been closed.