How can I check for active visit in my gsp file?

Platform Version: 1.11.2 OpenMRS Version: 2.2

How can I check for - if a patient is having active visit or not in my .gsp page using java script. Is there any documentation explaining about how to go about on this or any other example/ link. Please help

You could get that info via REST calling

if you use AngularJS then we have a dedicated service for getting visits. See:

Thank you Rafal for the pointer. It will surely help.