Does anyone have any examples of reading a yaml file through ajax?
Does anyone have any examples of reading a yaml file through ajax?

I've got this far but haven't managed to get it to work, any suggestions?
$('#example').dataTable( {
ajax: {
url: 'example.yml',
dataSrc: function (json) {return jsyaml.safeLoad(json.data);}
}
} );
This discussion has been closed.
Answers
I would start by adding a console log statement in the
dataSrc
function to see the results ofjsyaml.safeLoad(json.data)
. Do the results create a supported data structure as documented here?https://datatables.net/manual/data/
Do you get any alert messages or errors in the browser's console?
Kevin
Thanks for the response.
No console.logs or window.alerts in the dataSrc function seem to do anything, even just using static strings.
I get the warning 'This page uses the non standard property “zoom”. Consider using calc() in the relevant property values, or using “transform” along with “transform-origin: 0 0”.', but I'm fairly certain that's been appearing with everything I do (including when using a json file and it working as intended.
Not sure what you mean by "using static strings". I would verify that you are getting an ajax response using the browser's Developer Tools > Network. This technote provides steps to use the developer tools if you need.
Kevin
I mean if I put something along the lines of
console.log("Here's a string")
in the function. I've verified that the proper ajax response is happening.What is in the response? Please post an example.
Inside the dataSrc function what do you get if you use
console.log(json)
?What do you get with
console.log(jsyaml.safeLoad(json.data))
?Without seeing examples of what you are getting it will be impossible to help debug. Maybe you can post a link to your page so we can take a look.
Kevin