Only fire ajax request after initialisation
Only fire ajax request after initialisation
briangal
Posts: 5Questions: 0Answers: 0
Hey,
My use case is as follows:
I want to initially define my column headers and row data using JSON sent from the server.
I then want to use server-side processing for all my post Initialisation processing.
Here's what I have so far
[code]
$(document).ready(function() {
$.ajax( {
"dataType": 'text',
"type": "GET",
"url": "${request.contextPath}/report/getData",
"success": function (dataStr) {
var data = eval( '('+dataStr+')' );
$('#example').dataTable({
"bProcessing": true,
"bServerSide": true,
"aaData": data.aaData,
"aoColumns": data.aoColumns,
"sAjaxSource": "${request.contextPath}/report/getSubsetData"
});
}
} );
});
[/code]
The problem is, it is firing both ajax requests on initialisation.
Is there a way to exclude firing "sAjaxSource" request on initialisation, maybe using "fnServerData"?
My use case is as follows:
I want to initially define my column headers and row data using JSON sent from the server.
I then want to use server-side processing for all my post Initialisation processing.
Here's what I have so far
[code]
$(document).ready(function() {
$.ajax( {
"dataType": 'text',
"type": "GET",
"url": "${request.contextPath}/report/getData",
"success": function (dataStr) {
var data = eval( '('+dataStr+')' );
$('#example').dataTable({
"bProcessing": true,
"bServerSide": true,
"aaData": data.aaData,
"aoColumns": data.aoColumns,
"sAjaxSource": "${request.contextPath}/report/getSubsetData"
});
}
} );
});
[/code]
The problem is, it is firing both ajax requests on initialisation.
Is there a way to exclude firing "sAjaxSource" request on initialisation, maybe using "fnServerData"?
This discussion has been closed.
Replies
Allan