Your comments

Thanks Gil.
That is exactly what I needed.
Thanks Gil.
Thanks for your response. I will try that. But as you said it might not a prefect solution. I am going to access other variables like username, gender, etc., which are defined inside the AIML codes.
I was thinking of sending these variables using tag and send it to a javascript function inside a template tag.