AnsweredAssumed Answered

Simple Share component, where to put JavaScript?

Question asked by gronfelt on Aug 17, 2009
Latest reply on Jan 4, 2010 by mikeh
I have an ordinary webapp built with JavaScript, HTML and CSS, it's function is to connect to a LDAP-server and change the users password.

Now I would like to create a Share component out of that app. I've separated the CSS, JS and HTML to different files. Then I created a xml file and named it pwchange.get.desc.xml, renamed the HTML-file to pwchange.get.html.ftl and put them in appropriate directories. I also created a pwchange.get.head.ftl, that points to the CSS-file.

So far, so good. I've reloaded the webscripts and have been able to add my webapp to the share UI. The HTML looks right and the CSS is applied correctly.

But where do I put the JavaScript code? The major functionality of the code is to make a http request to another server and then receive the answer. Should it be in a js-file in the same location as the CSS file, should it be in pwchange.get.js along with the other files or should it simply be put in the html.ftl-file? I've tried all three and the only thing that seems to be working is putting the js-code in the html.ftl-file (which is basically just a html-file in this case), but that doesn't seem like the right way to do it.

Outcomes