Initialization issues

Initialization issues

deslyxiadeslyxia Posts: 3Questions: 0Answers: 0
edited September 2013 in General
Good Morning,

I recently came across the Data Tables plugin and I am having a little trouble initializing it in my C# MVC Project. I have a web service that i have verified as working. I am able to load my page and see that the ajax request fires off and works. Beyond that I am trying to setup an instance of dataTables on the page. As a test I wanted to do it using a predefined set of elements and later using ajax.

When i run the code below and inspect it i get the following error:

TypeError:$(...).dataTable is not a function


What am i doing wrong here?


Thank you for taking a look.




That being said here is what I have:

[code]













$(document).ready(function () {

function populateTable(json){
$('#dynamic').html('');
$('#example').dataTable({
"aaData":[
["Trident","IE4.0","Win95",4,"X"]
],
"aoColumns": [
{"sTitle":"Engine"},
{"sTitle": "Browser" },
{"sTitle": "Platform" },
{"sTitle": "Version" , "sClass":"center" },
{"sTitle": "Grade" , "sClass": "center"}
]
});
};

function getCampaigns() {
$.ajax({
url : '/ADKTest/GetCampaigns',
}).done(function(response) {
populateTable(response);
alert("Worked");
}).error(function(jQXHR, textStatus, errorThrown) {
alert("Didn't Work");
});
};

getCampaigns();

});




[/code]

Replies

  • allanallan Posts: 63,498Questions: 1Answers: 10,471 Site admin
    Load DataTables second, jQuery first. DataTables is a plugin to jQuery remember!

    Allan
  • deslyxiadeslyxia Posts: 3Questions: 0Answers: 0
    wow ... what an easy thing to miss ... thank you ...
This discussion has been closed.