I'm trying to use XML on a Flare page with JavaScript, similar to this example on W3Schools:
https://www.w3schools.com/xml/ajax_applications.asp.
The target is HTML5. I've done this type of thing successfully multiple times on non-Flare websites.
But for some reason, Flare is turning this:
Code: Select all
<script type="text/javascript" src="Resources/scripts/featured_resource.js">
show_resource(11);
</script>
Code: Select all
<script type="text/javascript" src="Resources/scripts/featured_resource.js">/* <![CDATA[ */
show_resource(11); /* ]]> */
</script>
I started out with all the code in the Flare page between script tags, but it did the CDATA thing. Then I put functions in the external file and called the main one from the web page as shown above--same problem. I even tried putting the function call in the external file, but then nothing happened.
I'm really puzzled as to why Flare is turning the code into CDATA and comments to boot. Any idea how I can get this to work properly? It's holding up an important project.
Thanks in advance--
Kathryn
P. S. Here is the code in the external .js file:
Code: Select all
function show_resource(i) {
var xmlhttp = new XMLHttpRequest();
xmlhttp.onreadystatechange = function() {
if (this.readyState == 4 && this.status == 200) {
myFunction(this, i);
}
};
xmlhttp.open("GET", "resources.xml", true);
xmlhttp.send();
}
function myFunction(xml, i) {
var xmlDoc = xml.responseXML;
x = xmlDoc.getElementsByTagName("resource");
document.getElementById("featured_resource").innerHTML =
x[i].getElementsByTagName("title")[0].childNodes[0].nodeValue;
}
Code: Select all
<resources>
<resource>
<type>presentation</type>
<date></date>
<title>Answers Hiding in Plain Sight: Using What You Know to Discover What You Don't Know</title>
<description>Ever feel like you're looking into a genealogical dark tunnel....</description>
<webinar_link>https://...</webinar_link>
<presentation_link>https://...</presentation_link>
<other_link></other_link>
<tags>research, timeline grid</tags>
</resource>
</resources>