Initialization issues
Initialization issues
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]
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]
This discussion has been closed.
Replies
Allan