Quantcast
Channel: Recent Discussions — DataTables forums
Viewing all articles
Browse latest Browse all 82018

Another question regarding loading records from a variable

$
0
0
I'm sorry for posting this question again, but I searched and read many threads on using fnServerData with no avail. I am trying to only load a list of patients from a specific Dr's ID. The doctor field in the patients DB is populated with the Dr's ID and the session variable that I want to use is $id.

<script type="text/javascript"> 
    $(document).ready(function() {
        $('#example').dataTable( {
        "bProcessing": true,
        "bServerSide": true,
        "sAjaxSource": "removedPath"
         "fnServerData": function ( sSource, aoData, fnCallback ) {
                        aoData.push( { "name" : "doctor", "value" : <?php $id;?>  } );
                        $.getJSON( sSource, aoData, function (json) {
                        fnCallback(json);
                    });
                    },

          } );
    } );
</script> 


// if id is specified, add it to the WHERE clause
if ( isset($_GET['doctor'])  && $_GET['doctor'] != "" ) {
    if ($sWhere) $sWhere .= " AND doctor=".mysql_real_escape_string( $_GET['doctor'] );
    else $sWhere = " WHERE doctor=".mysql_real_escape_string( $_GET['doctor'] );
}

Viewing all articles
Browse latest Browse all 82018

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>