<?xml version="1.0" encoding="UTF-8" ?>
<dt-example table-type="ajax" order="8">

<css lib="datatables" />
<js lib="jquery" />
<js lib="datatables" />

<title>Flat array data source</title>
<js><![CDATA[
$(document).ready(function() {
	$('#example').DataTable( {
		"ajax": {
			"url": "data/objects_root_array.txt",
			"dataSrc": ""
		},
		"columns": [
			{ "data": "name" },
			{ "data": "position" },
			{ "data": "office" },
			{ "data": "extn" },
			{ "data": "start_date" },
			{ "data": "salary" }
		]
	} );
} );
]]></js>

<info><![CDATA[

When loading data from an Ajax source, by default, DataTables will look for the data to use in the `data` parameter of a returned object (e.g. `{ "data": [...] }`). This can easily be change by using the `dataSrc` option of the `dt-init ajax` initiation option.

The `dt-init ajax.dataSrc` has a number of ways in which it can be used:

* As a string (e.g. `dataSrc: 'myData'`) - obtain data from a different property in the source object.
* As an empty string (e.g. `dataSrc: ''`) - the data source is not an object but an array.
* As a function (e.g. `dataSrc: function(json) {}`) - a function can be used to transform the data from one source format to another (for example you could convert from XML to a Javascript object). The value returned from the function is used as the data for the table.

The example below shows `dt-init ajax.dataSrc` being used as an empty string. This tells DataTables that the JSON loaded is a plain array, not an object with an array inside it as is the default.

]]></info>

</dt-example>
