Errors loading data
Errors loading data
I am having issues getting my datatable to load my JSON from the server i am using, i believe that it is because i don't have a title for the JSON, but i'm not sure how to get around it as there isn't an easy way for me to add a title to the JSON code. Below is the JavaScript
[code]require.config({ baseUrl: "/assets/iids/js/" });
require( ['jquery','ge/datatables'], function($) {
$(function () {
$('#servertable').dataTable( {
"bServerSide": false,
"bProcessing": true,
"sAjaxSource": "",
"aoColumns": [
{ "mData": "rate_id" },
{ "mData": "rate_label" },
{ "mData": "yearly_rate" }
],
"sAjaxDataProp": "",
"fnServerData": function ( sSource, aoData, fnCallback ) {
$.ajax( {
"crossDomain": true,
"dataType": 'jsonp',
"type": "GET",
"url": sSource,
"data": aoData,
"success": fnCallback
} );
}
} );
});
});
[/code]
and here is the JSON i'm attempting to use
[{"rate_id":1,"rate_label":"GE-MKE","yearly_rate":168251},{"rate_id":2,"rate_label":"GE-BLR","yearly_rate":46738},{"rate_id":3,"rate_label":"GE-HUN","yearly_rate":122699},{"rate_id":4,"rate_label":"PS-MKE","yearly_rate":140000},{"rate_id":5,"rate_label":"PS-BLR","yearly_rate":46140},{"rate_id":6,"rate_label":"Test","yearly_rate":5},{"rate_id":7,"rate_label":"test2","yearly_rate":10},{"rate_id":8,"rate_label":"GE-SRM","yearly_rate":123456},{"rate_id":9,"rate_label":"dsp-test","yearly_rate":654321}]
[code]require.config({ baseUrl: "/assets/iids/js/" });
require( ['jquery','ge/datatables'], function($) {
$(function () {
$('#servertable').dataTable( {
"bServerSide": false,
"bProcessing": true,
"sAjaxSource": "",
"aoColumns": [
{ "mData": "rate_id" },
{ "mData": "rate_label" },
{ "mData": "yearly_rate" }
],
"sAjaxDataProp": "",
"fnServerData": function ( sSource, aoData, fnCallback ) {
$.ajax( {
"crossDomain": true,
"dataType": 'jsonp',
"type": "GET",
"url": sSource,
"data": aoData,
"success": fnCallback
} );
}
} );
});
});
[/code]
and here is the JSON i'm attempting to use
[{"rate_id":1,"rate_label":"GE-MKE","yearly_rate":168251},{"rate_id":2,"rate_label":"GE-BLR","yearly_rate":46738},{"rate_id":3,"rate_label":"GE-HUN","yearly_rate":122699},{"rate_id":4,"rate_label":"PS-MKE","yearly_rate":140000},{"rate_id":5,"rate_label":"PS-BLR","yearly_rate":46140},{"rate_id":6,"rate_label":"Test","yearly_rate":5},{"rate_id":7,"rate_label":"test2","yearly_rate":10},{"rate_id":8,"rate_label":"GE-SRM","yearly_rate":123456},{"rate_id":9,"rate_label":"dsp-test","yearly_rate":654321}]
This discussion has been closed.
Replies
Allan