The CreatorCon Call for Content is officially open! Get started here.

Can we include javascript in a HTML field?

dave_edgar
Mega Guru

I need to create a catalog item that returns API response data in an array to show in drop downs.

I have tried using client script/script include but can not use XMLDocument on a script include or get the array variable from the script include back to the catalog client script with the getXML.

So, I set a HTML variable to show like so:

Screen Shot 2018-01-24 at 13.51.02.png

But when putting any script behind the 'Click Me' button, such as:

<script>function myFunction() {console.log("Hello World");}</script>

it disappears from the html source code

Any ideas??

2 REPLIES 2

rahulpandey
Kilo Sage

Hi,



This would be fairly possible via client script and script include. You can trigger a sync call via getXMLWait,


thats the problem i have the getXML and getXMLWAIT return to me an xml file which i then need to stripe out data int arrays, and XMLDocument is not not allowed to be run at catalog client script level