fnServeData and xml
fnServeData and xml
Hello,
I have used Datatables in various configurations for the last 6 months. Now I have the following requirement and I'm stuck. The source file is xml and I would like to use fnServerData to convert it to a usable format:
Now, I know how to parse an xml file in the following way to append to an element, but I'm stuck on how to make the jump to using fnServerData. Has anyone had any experience with this kind of setup?
[code]
$(document).ready(function()
{
$.ajax({
type: "GET",
url: "/rds/reportData/path/Public%20Folders/maps/branches?selection=list1&fmt=simple",
dataType: "xml",
success: parseXml
});
});
function parseXml(xml)
{
$("#example").append('"aaData": [');
$(xml).find("row").each(function()
{
$("#example").append('["'+$(this).find("Address").find("val").text()+',');
$("#example").append($(this).find("Branch__key").find("val").text()+']');
});
}
[code]
I have used Datatables in various configurations for the last 6 months. Now I have the following requirement and I'm stuck. The source file is xml and I would like to use fnServerData to convert it to a usable format:
Now, I know how to parse an xml file in the following way to append to an element, but I'm stuck on how to make the jump to using fnServerData. Has anyone had any experience with this kind of setup?
[code]
$(document).ready(function()
{
$.ajax({
type: "GET",
url: "/rds/reportData/path/Public%20Folders/maps/branches?selection=list1&fmt=simple",
dataType: "xml",
success: parseXml
});
});
function parseXml(xml)
{
$("#example").append('"aaData": [');
$(xml).find("row").each(function()
{
$("#example").append('["'+$(this).find("Address").find("val").text()+',');
$("#example").append($(this).find("Branch__key").find("val").text()+']');
});
}
[code]
This discussion has been closed.
Replies
[code]
success: function ( xml ) {
callback( parseXml( xml ) );
}
[/code]
Allan