can not get external data
can not get external data
redhookbaker
Posts: 31Questions: 0Answers: 0
Hi,
Please see below. If I put json in the same page, it works fine, if I call it from the external page, no error, no data on the page. I have tried {} and "{}". Please help.....Also, this is a great piece of software...thanks...I am gong to donate some $$ ...thanks again LOL
[code]
$(document).ready(function() {
$('#example').dataTable( {
"bProcessing": true,
"bServerSide": true,
"bFilter": true,
//"sAjaxSource": {"sEcho": 0, "iTotalRecords": 57, "iTotalDisplayRecords": 57, "aaData": [ ["Trident","Internet Explorer 4.0","Win 95+","4","X"],["Trident","Internet Explorer 5.0","Win 95+","5","C"],["Trident","Internet Explorer 5.5","Win 95+","5.5","A"],["Trident","Internet Explorer 6","Win 98+","6","A"],["Trident","Internet Explorer 7","Win XP SP2+","7","A"],["Trident","AOL browser (AOL desktop)","Win XP","6","A"],["Gecko","Firefox 1.0","Win 98+ / OSX.2+","1.7","A"],["Gecko","Firefox 1.5","Win 98+ / OSX.2+","1.8","A"],["Gecko","Firefox 2.0","Win 98+ / OSX.2+","1.8","A"],["Gecko","Firefox 3.0","Win 2k+ / OSX.3+","1.9","A"],["Gecko","Camino 1.0","OSX.2+","1.8","A"],["Gecko","Camino 1.5","OSX.3+","1.8","A"],["Gecko","Netscape 7.2","Win 95+ / Mac OS 8.6-9.2","1.7","A"],["Gecko","Netscape Browser 8","Win 98SE+","1.7","A"],["Gecko","Netscape Navigator 9","Win 98+ / OSX.2+","1.8","A"],["Gecko","Mozilla 1.0","Win 95+ / OSX.1+","1","A"],["Gecko","Mozilla 1.1","Win 95+ / OSX.1+","1.1","A"],["Gecko","Mozilla 1.2","Win 95+ / OSX.1+","1.2","A"],["Gecko","Mozilla 1.3","Win 95+ / OSX.1+","1.3","A"],["Gecko","Mozilla 1.4","Win 95+ / OSX.1+","1.4","A"],["Gecko","Mozilla 1.5","Win 95+ / OSX.1+","1.5","A"],["Gecko","Mozilla 1.6","Win 95+ / OSX.1+","1.6","A"],["Gecko","Mozilla 1.7","Win 98+ / OSX.1+","1.7","A"],["Gecko","Mozilla 1.8","Win 98+ / OSX.1+","1.8","A"],["Gecko","Seamonkey 1.1","Win 98+ / OSX.2+","1.8","A"],["Gecko","Epiphany 2.20","Gnome","1.8","A"],["Webkit","Safari 1.2","OSX.3","125.5","A"],["Webkit","Safari 1.3","OSX.3","312.8","A"],["Webkit","Safari 2.0","OSX.4+","419.3","A"],["Webkit","Safari 3.0","OSX.4+","522.1","A"],["Webkit","OmniWeb 5.5","OSX.4+","420","A"],["Webkit","iPod Touch / iPhone","iPod","420.1","A"],["Webkit","S60","S60","413","A"],["Presto","Opera 7.0","Win 95+ / OSX.1+","-","A"],["Presto","Opera 7.5","Win 95+ / OSX.2+","-","A"],["Presto","Opera 8.0","Win 95+ / OSX.2+","-","A"],["Presto","Opera 8.5","Win 95+ / OSX.2+","-","A"],["Presto","Opera 9.0","Win 95+ / OSX.3+","-","A"],["Presto","Opera 9.2","Win 88+ / OSX.3+","-","A"],["Presto","Opera 9.5","Win 88+ / OSX.3+","-","A"],["Presto","Opera for Wii","Wii","-","A"],["Presto","Nokia N800","N800","-","A"],["Presto","Nintendo DS browser","Nintendo DS","8.5","C/A1"],["KHTML","Konqureror 3.1","KDE 3.1","3.1","C"],["KHTML","Konqureror 3.3","KDE 3.3","3.3","A"],["KHTML","Konqureror 3.5","KDE 3.5","3.5","A"],["Tasman","Internet Explorer 4.5","Mac OS 8-9","-","X"],["Tasman","Internet Explorer 5.1","Mac OS 7.6-9","1","C"],["Tasman","Internet Explorer 5.2","Mac OS 8-X","1","C"],["Misc","NetFront 3.1","Embedded devices","-","C"],["Misc","NetFront 3.4","Embedded devices","-","A"],["Misc","Dillo 0.8","Embedded devices","-","X"],["Misc","Links","Text only","-","X"],["Misc","Lynx","Text only","-","X"],["Misc","IE Mobile","Windows Mobile 6","-","C"],["Misc","PSP browser","PSP","-","C"],["Other browsers","All others","-","-","U"]] }
"sAjaxSource": "testData.asp"
} );
} );
[/code]
Please see below. If I put json in the same page, it works fine, if I call it from the external page, no error, no data on the page. I have tried {} and "{}". Please help.....Also, this is a great piece of software...thanks...I am gong to donate some $$ ...thanks again LOL
[code]
$(document).ready(function() {
$('#example').dataTable( {
"bProcessing": true,
"bServerSide": true,
"bFilter": true,
//"sAjaxSource": {"sEcho": 0, "iTotalRecords": 57, "iTotalDisplayRecords": 57, "aaData": [ ["Trident","Internet Explorer 4.0","Win 95+","4","X"],["Trident","Internet Explorer 5.0","Win 95+","5","C"],["Trident","Internet Explorer 5.5","Win 95+","5.5","A"],["Trident","Internet Explorer 6","Win 98+","6","A"],["Trident","Internet Explorer 7","Win XP SP2+","7","A"],["Trident","AOL browser (AOL desktop)","Win XP","6","A"],["Gecko","Firefox 1.0","Win 98+ / OSX.2+","1.7","A"],["Gecko","Firefox 1.5","Win 98+ / OSX.2+","1.8","A"],["Gecko","Firefox 2.0","Win 98+ / OSX.2+","1.8","A"],["Gecko","Firefox 3.0","Win 2k+ / OSX.3+","1.9","A"],["Gecko","Camino 1.0","OSX.2+","1.8","A"],["Gecko","Camino 1.5","OSX.3+","1.8","A"],["Gecko","Netscape 7.2","Win 95+ / Mac OS 8.6-9.2","1.7","A"],["Gecko","Netscape Browser 8","Win 98SE+","1.7","A"],["Gecko","Netscape Navigator 9","Win 98+ / OSX.2+","1.8","A"],["Gecko","Mozilla 1.0","Win 95+ / OSX.1+","1","A"],["Gecko","Mozilla 1.1","Win 95+ / OSX.1+","1.1","A"],["Gecko","Mozilla 1.2","Win 95+ / OSX.1+","1.2","A"],["Gecko","Mozilla 1.3","Win 95+ / OSX.1+","1.3","A"],["Gecko","Mozilla 1.4","Win 95+ / OSX.1+","1.4","A"],["Gecko","Mozilla 1.5","Win 95+ / OSX.1+","1.5","A"],["Gecko","Mozilla 1.6","Win 95+ / OSX.1+","1.6","A"],["Gecko","Mozilla 1.7","Win 98+ / OSX.1+","1.7","A"],["Gecko","Mozilla 1.8","Win 98+ / OSX.1+","1.8","A"],["Gecko","Seamonkey 1.1","Win 98+ / OSX.2+","1.8","A"],["Gecko","Epiphany 2.20","Gnome","1.8","A"],["Webkit","Safari 1.2","OSX.3","125.5","A"],["Webkit","Safari 1.3","OSX.3","312.8","A"],["Webkit","Safari 2.0","OSX.4+","419.3","A"],["Webkit","Safari 3.0","OSX.4+","522.1","A"],["Webkit","OmniWeb 5.5","OSX.4+","420","A"],["Webkit","iPod Touch / iPhone","iPod","420.1","A"],["Webkit","S60","S60","413","A"],["Presto","Opera 7.0","Win 95+ / OSX.1+","-","A"],["Presto","Opera 7.5","Win 95+ / OSX.2+","-","A"],["Presto","Opera 8.0","Win 95+ / OSX.2+","-","A"],["Presto","Opera 8.5","Win 95+ / OSX.2+","-","A"],["Presto","Opera 9.0","Win 95+ / OSX.3+","-","A"],["Presto","Opera 9.2","Win 88+ / OSX.3+","-","A"],["Presto","Opera 9.5","Win 88+ / OSX.3+","-","A"],["Presto","Opera for Wii","Wii","-","A"],["Presto","Nokia N800","N800","-","A"],["Presto","Nintendo DS browser","Nintendo DS","8.5","C/A1"],["KHTML","Konqureror 3.1","KDE 3.1","3.1","C"],["KHTML","Konqureror 3.3","KDE 3.3","3.3","A"],["KHTML","Konqureror 3.5","KDE 3.5","3.5","A"],["Tasman","Internet Explorer 4.5","Mac OS 8-9","-","X"],["Tasman","Internet Explorer 5.1","Mac OS 7.6-9","1","C"],["Tasman","Internet Explorer 5.2","Mac OS 8-X","1","C"],["Misc","NetFront 3.1","Embedded devices","-","C"],["Misc","NetFront 3.4","Embedded devices","-","A"],["Misc","Dillo 0.8","Embedded devices","-","X"],["Misc","Links","Text only","-","X"],["Misc","Lynx","Text only","-","X"],["Misc","IE Mobile","Windows Mobile 6","-","C"],["Misc","PSP browser","PSP","-","C"],["Other browsers","All others","-","-","U"]] }
"sAjaxSource": "testData.asp"
} );
} );
[/code]
This discussion has been closed.
Replies
Thanks for the donation :-). The sAjaxSource property tells DataTables what page it should load from the web-server to get the JSON data. There are a number of different ways that you can deal with JSON data with DataTables:
1. Javascript array - when you have the data already on the client-side - http://datatables.net/examples/data_sources/js_array.html
2. Ajax file - load an JSON file (all data records in a single go) and have all the processing (sorting, filtering etc) done on the client-side: http://datatables.net/examples/data_sources/ajax.html
3. Server-side processing - have all the processing done by the server (typically an SQL database or the like): http://datatables.net/examples/data_sources/server_side.html . This is great when you've got a large amount of data to display.
Which is it that you are trying to use? If server-side processing, then your ASP script will need to reply to the request sent by DataTables as needed: http://www.datatables.net/usage/server-side . There are some sample scripts in this thread http://datatables.net/forums/comments.php?DiscussionID=937 - although I'm afraid I know nothing about ASP, so might not be a huge amount of help there.
Regards,
Allan
Thanks for the quick reply. The external page I use is called testData.asp, when I run this page directly, here is what I have, I tried with/with out "", it does not show data. It also passes validation as a valid json..thanks
[code]
"{"aaData": [ ["1","demo1 ","demo2 ","","demo3 "], ["2","DEMO ","DEMO ","","DEMO "], ["3","demo Group ","demo group ","","winter "], ["5","ml llc ","ml llc1 ","","MLDirect "] ]}"
[/code]
Try this then:
[code]
$(document).ready(function() {
$('#example').dataTable( {
"bProcessing": true,
"sAjaxSource": "testData.asp"
} );
} );
[/code]
Note that filtering is on by default, so I've dropped that out.
Allan
The end result by running php and asp is the same, really strange...
The link you gave is for server-side processing (option 3), but the JSON structure you gave is for client-side processing (option 2).
Can you provide a link to the page please?
Allan
http://209.59.1.252/testdata.asp
[code]
$(document).ready(function() {
$('#example').dataTable( {
"bProcessing": true,
"sAjaxSource": "testData.asp"
} );
} );
[/code]
Allan
but if I use http://209.59.1.252/testdata.asp, bServerSide set to True or False, i am getting
DataTable Warning: Added data does not match number of known columns.....
I am sorry to keep bugging you..thanks
Exact same data, if I call the page name (testdata.asp), it does not work; if I use the local rurl (http://my-pc...../testdata.asp), it doesnt work......how weird is that? thx
Allan
Webpage error details
User Agent: Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1; Trident/4.0; .NET CLR 1.1.4322; .NET CLR 2.0.50727; OfficeLiveConnector.1.3; OfficeLivePatch.0.0; .NET CLR 3.0.4506.2152; .NET CLR 3.5.30729)
Timestamp: Wed, 10 Mar 2010 15:20:30 UTC
Message: Access is denied.
Line: 127
Char: 287
Code: 0
URI: https://www.mysite.com/js/jquery.js
any thoughts? thanks
in the meantime, is there any documentation regarding the settings, such as the parameter list
bProcessing
bServerSide
bFilter
...
thanks
Also this page ( http://datatables.net/usage/ ) defines the different data sources. It really is sounding like an XSS issue...
Allan
thanks
Allan
Allan
I am going to try Java array, can you point me to the document/seetings for java array? thanks
Allan
http://datatables.net/examples/data_sources/js_array.html
I get the data from SQL and parse it into java array and it works great....thanks
I want to see if there are options like the server-side that can set bFilter=false, something like that...thanks
> I want to see if there are options like the server-side that can set bFilter=false, something like that...
Yes - the same options apply as client-side processing. Using a JS array (in the example link you posted) is client-side processing. So bFilter:false will do it. Did you try that? That will also remove the filter box. All of the configuration parameters are listed in the 'Usage' section of this site.
Allan
1. How can I change the sorting column color ?
2. Is there a way to hightlight rows when mouse mover? thx
2. Again yes - using CSS :hover - http://www.google.com/search?q=css+%3Ahover
Allan
last question, is it possible to add button on each row? thx
Allan