External Script Question

External Script Question

zgoforthzgoforth Posts: 493Questions: 98Answers: 2

I am trying to clean my code up, because of all the extensions and options I have in my DataTable, my total length of code in in line HTML/CSS/JS is like 1350 lines.

In my DataTablesJS.js file, where I will only have my relevant JS within my $(window).on('load', function () {}), I am wondering if I need to insert my Ajax call that gets the table data there, or if I can still have that in its own JS file, and it will still populate since I am drawing that Data to the DataTable.

Answers

  • kthorngrenkthorngren Posts: 21,322Questions: 26Answers: 4,948

    The answer is it depends :smile:

    Datatables has no requirements around this. Without knowing your environment its hard to say what you need to do. You need to pay attention to Javascript load order and scoping. All of this is general Javascript setup. Stack Overflow would be a good place to look for ideas of how to break up your filles.

    Kevin

Sign In or Register to comment.