Uncaught TypeError: $(...).DataTable is not a function
Uncaught TypeError: $(...).DataTable is not a function

I do not get this error if I let the link that starts this off flow through function prelistPlanLevelsClick() w/o catching the event.
The problem then is it loads in the entire browser.
I'm using jQuery .one() vs .on() to make sure I only reach prelistPlanLevelsClick() once.
The alerts confirm I'm entering each JS function once.
Function that loads page list_plan_levels.html
`// =================================================================================================
// This function responds to clicks in prelist_plan_levels.html
// and loads list_plan_levels.html, whose .ready() function is below this one.
function prelistPlanLevelsClick(event)
{
event.preventDefault() ;
var UpDown = $(this).data('updown');
var posted_period = $(this).data('pp');
var scope = $(this).data('scope');
localStorage.UpDown = UpDown ;
localStorage.posted_period = posted_period ;
localStorage.scope = scope ;
alert("PreLoad") ;
var target = '#' + $(this).data('target');
var link = $(this).attr('href')
$(target).load(link, function( response, status, xhr )
{
if ( status == "error" )
{
var msg = "Sorry but there was an error in function listPlanLevelsClick() when trying to load 'better plans' list: ";
$( "#error" ).html( msg + xhr.status + " " + xhr.statusText );
}
} );
}`
.ready()** function list_plan_levels()**
`// =================================================================================================
// .ready() function for page: list_plan_levels.html
function list_plan_levels()
{
alert("list_plan_levels()") ;
/*
var UpOrDown = localStorage.UpDown ;
var posted_period = localStorage.posted_period ;
var Tscope = localStorage.scope ;
var php_params = 'job=UpDownGrade&UpDown='+UpOrDown+'&posting_period='+posted_period+'&scope='+Tscope ;
$('#debug').html(php_params) ; // For visibility in header of window
*/
$('#UpDownGrade').DataTable(
{
/* ajax: {
url: '/cmdb/PHP/do_DataTables_query.php' ,
data: { job: 'UpDownGrade'
, UpDown: UpOrDown // e.g.: 'Up'
, posting_period: posted_period // e.g.: 'Nov 2015'
, scope: Tscope // e.g.: 'PP'
},
dataSrc: 'PlanChange'
},*/
columns: [
{ data: 'View' }
, { data: 'Select' }
, { data: 'Commit' }
, { data: 'wireless #' }
, { data: 'serial #' }
, { data: 'curr usage' }
, { data: 'curr limit' }
, { data: 'curr code' }
, { data: 'better code' }
, { data: 'prior inv.', 'defaultContent': "--" }
, { data: 'prior usage', 'defaultContent': "--" }
, { data: 'prior code', 'defaultContent': "--" }
, { data: 'prior inv.', 'defaultContent': "--" }
, { data: 'prior usage', 'defaultContent': "--" }
, { data: 'prior code', 'defaultContent': "--" }
, { data: 'Show' }
, { data: 'Mark' }
]
} );
}
`
Answers
Thanks for your question - however, per the forum rules can you link to a test case showing the issue please. This will allow the issue to be debugged.
Information on how to create a test page, if you can't provide a link to your own page can be found here.
Thanks,
Allan