Jump to content

rplohocky

Members
  • Posts

    1
  • Joined

  • Last visited

Everything posted by rplohocky

  1. Hello, This is my first post on this site! I use a wordpress site and am using a plugin that works with Google maps. I wrote some code and it doesn’t seem to be working. The plugin works with service areas that you make on the map. When a customer searches for there address the code is supposed to check if it falls inside a polygon or not and then take them to one page or another. I have 5 polygons and this code is programmed to send customers to different pages based on where there address appears. Can someone look at the code to see what I’m missing? jQuery(function($) { $('body').on('storelocatorresult.wpgmza', function(event) { var location = new google.maps.LatLng(event.center); //you can add multiple polygon IDs by separating with a comma var contains = google.maps.geometry.poly.containsLocation(location, WPGM_Path_Polygon[1]); if (!contains) { // outside of polygon window.location.href = "outofarea"; } else { // inside polygon window.location.href = "fiber"; } }); }); jQuery(function($) { $('body').on('storelocatorresult.wpgmza', function(event) { var location = new google.maps.LatLng(event.center); //you can add multiple polygon IDs by separating with a comma var contains = google.maps.geometry.poly.containsLocation(location, WPGM_Path_Polygon[2]); if (!contains) { // outside of polygon window.location.href = "outofarea"; } else { // inside polygon window.location.href = "fiber"; } }); }); jQuery(function($) { $('body').on('storelocatorresult.wpgmza', function(event) { var location = new google.maps.LatLng(event.center); //you can add multiple polygon IDs by separating with a comma var contains = google.maps.geometry.poly.containsLocation(location, WPGM_Path_Polygon[3]); if (!contains) { // outside of polygon window.location.href = "outofarea"; } else { // inside polygon window.location.href = "fixedwireless"; } }); }); jQuery(function($) { $('body').on('storelocatorresult.wpgmza', function(event) { var location = new google.maps.LatLng(event.center); //you can add multiple polygon IDs by separating with a comma var contains = google.maps.geometry.poly.containsLocation(location, WPGM_Path_Polygon[4]); if (!contains) { // outside of polygon window.location.href = "outofarea"; } else { // inside polygon window.location.href = "comingsoon"; } }); }); jQuery(function($) { $('body').on('storelocatorresult.wpgmza', function(event) { var location = new google.maps.LatLng(event.center); //you can add multiple polygon IDs by separating with a comma var contains = google.maps.geometry.poly.containsLocation(location, WPGM_Path_Polygon[5]); if (!contains) { // outside of polygon window.location.href = "outofarea"; } else { // inside polygon window.location.href = "ltewireless"; } }); });
×
×
  • Create New...