Retrieving template text with JavaScript sounds a weird requirement to me. You can evaluate other design options to fulfill your goals.
One more thing,
String[] s=new String[];
Above statement won't compile as you haven't specified the dimension(size of the array).