I have an HTML file on my server, and a Javascript file on the same server. I want it so that when I load the HTML file, it will the reference of .js file placed on the server.
I tried this way:
<html> <head> <script type="text/javascript src="...server side path...."></script> </head> </html>
but it is not working. Can any one tell me how I can do this?! I attached the code
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:form="http://www.w3.org/2002/xforms" xml:lang="en"> <head> <script type="text/javascript" src="~/FormFaces/formfaces.js"></script> <form:model> <form:instance> <data xmlns=""> <textbox1></textbox1> <textbox2></textbox2> <textbox3></textbox3> </data> </form:instance> </form:model> </head> <body> <table><tr><td><form:input ref="textbox1"> <form:label>TextBox1</form:label> </form:input> </td><td><form:input ref="textbox2"> <form:label>TextBox2</form:label> </form:input> </td></tr><tr><td><form:input ref="textbox3"> <form:label>TextBox3</form:label> </form:input> </td><td></td></tr> </table></body> </html>
` I want the formfaces.js file to be included in my Text.html file. But when i run the text.html file through my local server in a browser, it doesnot load the formfaces.js file. IF i run that file manually , all works fine
Advertisement
Answer
Javascript files are read and executed on the client.
You need to use a client-side path; the browser will send an HTTP request to that URL.