25
I try add javascript to my velocity template.
<html>
<head>
<title>:: $currency.CurrencyName Detail Info ::</title>
</head>
<body>
<table>
<tr>
<td>Name</td>
<td>$currency.CurrencyName</td>
</tr>
<tr>
<td>Jual</td>
<td><div id="$currency.CurrencyName_buy">$currency.Buy</div></td>
</tr>
<tr>
<td>Beli</td>
<td><div id="$currency.CurrencyName_sell">$currency.Sell</div></td>
</tr>
</table>
<script src="http://code.jquery.com/jquery-latest.min.js"></script>
<script>
$(document).ready(function() {
setInterval(function() {
$.get('updateCurrency.htm', function(data) {
$('#time').text(data);
});
}, 5 * 60 * 1000); // 1000 milliseconds = 1 second.
});
</script>
<p>Current date/time is: <span id="time"></span>
</body>
</html>
but I got the following error:
org.apache.velocity.exception.ParseErrorException: Encountered "," at line 28, column 29 of currencyDetail.html
Was expecting one of:
<EOF>
"(" ...
<RPAREN> ...
<ESCAPE_DIRECTIVE> ...
<SET_DIRECTIVE> ...
"##" ...
"\\\\" ...
"\\" ...
<TEXT> ...
"*#" ...
"*#" ...
<STRING_LITERAL> ...
<IF_DIRECTIVE> ...
<STOP_DIRECTIVE> ...
<INTEGER_LITERAL> ...
<FLOATING_POINT_LITERAL> ...
<WORD> ...
<BRACKETED_WORD> ...
<IDENTIFIER> ...
<DOT> ...
"{" ...
"}" ...
at org.apache.velocity.Template.process(Template.java:137)
at org.apache.velocity.runtime.resource.ResourceManagerImpl.loadResource(ResourceManagerImpl.java:415)
at org.apache.velocity.runtime.resource.ResourceManagerImpl.getRes