DataTables error when using jQuery hosted at Google CDN: jQuery is not defined

DataTables error when using jQuery hosted at Google CDN: jQuery is not defined

afarberafarber Posts: 53Questions: 0Answers: 0
edited March 2012 in General
Hello,

I'm trying to use a locally hosted DataTables.net 1.8.2 with the jQuery/jQuery UI hosted at the Google CDN.

With the static -tags everything works ok, but when I switch to google.load() (and I have to, because I'd like to start using Google visualization API) - I get the error "jquery.dataTables.min.js:151 Uncaught ReferenceError: jQuery is not defined"

[code]

@import "/demo_table_jui.css";
@import "https://ajax.googleapis.com/ajax/libs/jqueryui/1/themes/redmond/jquery-ui.css";




google.load("jquery", "1");
google.load("jqueryui", "1");
google.load("maps", "2", {language: "ru"});
google.setOnLoadCallback(function() {
// ...
$("#comments").dataTable( {
"bJQueryUI": true,
"sPaginationType": "full_numbers",
"aaSorting": [[0, "desc"]]
});
});
[/code]

I've provided more details at:
http://stackoverflow.com/questions/9957084/google-loader-doesnt-work-with-datatables-net-local-and-google-maps-cdn

Does anybody please have any suggestions?

Thank you
Alex

Replies

  • allanallan Posts: 61,451Questions: 1Answers: 10,055 Site admin
    You are loading DataTables before jQuery, but jQuery is a dependency of DataTables - hence the error you are getting. So you need to make sure that DataTables is loaded after jQuery. Given that you are using the Google loader, you might need to load DataTables using that (if is does async loading).

    Allan
This discussion has been closed.