I am getting records from database in my HTML
<g:each in="${index}">
${""+it.indexDate+""+it.value }
</g:each>
It’s working fine, but I want to use this record below in my javascript:
I want to do some thing like this
<SCRIPT LANGUAGE="JavaScript">
if(it.value>10){
alert("yes")
}
Is there a way I can do that?
Apparently you want to do exactly the same as what is described in this question.
Trying to access your database directly Javascript might be feasible but it is never a good idea.
In fact, the Javascript runs on the client side, and you don’t want your clients to be able to mess up with your data. I would highly recommend using Ajax. That is to say, be able to asynchronously call the server side (PHP or any other server-side language you use) from the client side to request what you need from the database.