2 users online. Create an account or sign in to join them.Users
Page output JSON for Ajax usage
This is an open discussion with 2 replies, filed under XSLT.
Search
Have you tried the text output method?
<xsl:output method="text"
omit-xml-declaration="yes"
encoding="UTF-8" />
Thanks, Michael.
omit-xml-declaration="yes" did the trick. I didn't know about it.
Create an account or sign in to comment.
Hello.
Is there a way for a Symphony page to output nice and clean JSON?
I'm using jQuery to make an Ajax call to retrieve dates of events in JSON format:
$.get( url, { year: year, month: month}, function(result){ ... }, "json" );The page XSLT is transforming the resulting DSs' XML very well but the result contains an XML declaration like this:
<?xml version="1.0"?> [ "1", { start: "2011-04-29", sfarsit: "2011-05-03" },{ start: "2011-05-25", sfarsit: "2011-06-02" } ]This is definitely the cause of failure for the Ajax call. I noticed that the XML declaration
<?xml version="1.0"?>is automatically inserted after the XSLT processing of the XML, line 158 inclass.xsltprocess.php:Any suggestions?
Thank you.