views:

50

answers:

3

Is there anyway to load the drop down menu of an html from another file(A text file) ?

I tried this and I guess it is not working.

<form>
<select name  = "Name">
<!--#include virtual="options.txt" -->
</select>
</form>

and inside options.txt

<option value = "42a">42A</option>
<option value = "42b">42B</option>
<option value = "42c">42C</option>
<option value = "42d">42D</option>
<option value = "42e">42E</option>
<option value = "43a">43A</option>
A: 

Yes, you can use a server side include.

<!--#include virtual="../header.txt" -->
Moses
I moving this edit to main question
alertjean
In order for a server-side include to work, you first must be using the correct path (#virtual path is relative to the root folder). Secondly, you must be using either an Apache, Lighttbd, or IIS server.
Moses
A: 

Load on the server in java / jsp

<%@ include file="drop_down.jspf" %>
// Or 
<jsp:include page="<%=variable_containing_relative_path_to_drop_down.jspf%>" />

Load by the browser in javascript / jQuery

$("#my_container").load("http://mon_site.com/fragment/drop_down.html");
Patrick Ferreira
A: 

I finally solved this by using html templates and Perl-CGI. The include of template works like charm.

alertjean