allow CORS on server side examples
allow CORS on server side examples

When playing around with the server side examples locally, it would be very convenient if the service side data service examples support CORS.
It looks like it may simply be a one line change to enable. <?php header("Access-Control-Allow-Origin: *");
http://enable-cors.org/server_php.html.
With it enabled, this should work from a local file:
$.ajax({
type: 'GET',
dataType: 'json',
contentType: 'application/json; charset=utf-8',
url: 'http://www.datatables.net/release-datatables/examples/server_side/scripts/server_processing.php'
});
In the meanwhile, it is possible to load Chrome with same origin policy disabled, but is not a great workaround.
It looks like it may simply be a one line change to enable. <?php header("Access-Control-Allow-Origin: *");
http://enable-cors.org/server_php.html.
With it enabled, this should work from a local file:
$.ajax({
type: 'GET',
dataType: 'json',
contentType: 'application/json; charset=utf-8',
url: 'http://www.datatables.net/release-datatables/examples/server_side/scripts/server_processing.php'
});
In the meanwhile, it is possible to load Chrome with same origin policy disabled, but is not a great workaround.
This discussion has been closed.
Replies
I'm not overly keen on opening more resources on this little server - its already getting a hammering! :-). Indeed I was actually thinking of ways to reduce the server being (incorrectly) used as a CDN by many. But certainly something I'll keep in mind for future as I can see it would be useful for testing.
Allan
http://blog.ctaggart.com/2013/01/trying-out-typescript.html