EDIT: It seems that this issue is only happening in Chrome. Firefox is fine.
Footable is a JQuery plugin. https://fooplugins.com/plugins/footable-jquery/
The following function is used by the "Footable" plugin to make the .table class have a nice layout. :
jQuery('.table').footable({
"columns": result,
"rows": response
});
I want to run the function inside an AJAX call:
$.get('../php/campaignmanagement.php', function(response){
response = JSON.parse(response);
var columns = Object.keys(response[0]);
var result = columns.map(x => {
return {
title: x,
name: x
}//end return
});
//FUNCTION HERE
jQuery('.table').footable({
"columns": result,
"rows": response
});
//FUNCTION ABOVE
......... Other irrelevant code...
});
This gives me the following error:
jQuery(...).footable is not a function
However, if I move the function outside the AJAX function, it works.
e.g.
//FUNCTION HERE
jQuery('.table').footable({
"columns": result,
"rows": response
});
//FUNCTION ABOVE
$.get('../php/campaignmanagement.php', function(response){
response = JSON.parse(response);
var columns = Object.keys(response[0]);
var result = columns.map(x => {
return {
title: x,
name: x
}//end return
});
......... Other irrelevant code...
});
I need to be able to run the function from within AJAX. Why would AJAX be causing everything to break?
FYI: The HTML document is calling the scripts like this:(campaignmanagement.js is the file which runs the above functions)
<script src="../vendors/jquery/jquery.js"></script>
<script src="../vendors/footable/js/footable.js"></script>
<script src="../vendors/foundation 6/foundation.js" type="text/javascript"></script>
<script src="../js/campaignmanagement.js"></script>