I have a form with a hidden input that saves user's current zoom level
<input type="hidden" name="zoom" value="15" id="zoom" /> <!-- default value="" -->
However, when I try to use the zoom value from the input after I submit my form it doesn't use the input's value
var zoom = $("#zoom").val();
var point;
var gmap = new GMap2(document.getElementById("gmap"));
if (zoom == "") {
point = new google.maps.LatLng(latitude,longitude);
gmap.setCenter(point, 13);
} else {
console.log(zoom); //shows 15
point = new google.maps.LatLng(latitude,longitude);
gmap.setCenter(point, zoom); //here the zoom is undefined
}