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 http://demo.openmrs.org/openmrs/ws/rest/v1/visit?patient=94fd268e-9b39-4b30-b150-4c777f077ae8&includeInactive=false

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

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