Skip to content

Instantly share code, notes, and snippets.

@timersys
Last active May 10, 2021 12:48
Show Gist options
  • Save timersys/fd89fe2fa40dce472db0b5223aae5bbc to your computer and use it in GitHub Desktop.
Save timersys/fd89fe2fa40dce472db0b5223aae5bbc to your computer and use it in GitHub Desktop.

Revisions

  1. timersys revised this gist May 10, 2021. 1 changed file with 9 additions and 11 deletions.
    20 changes: 9 additions & 11 deletions app.js
    Original file line number Diff line number Diff line change
    @@ -1,14 +1,12 @@
    $(document).on('geotwp_ajax_success', function(e, data) {
    if( typeof data.geo != 'undefined') {
    // create a custom cookie with zip value and 999 days duration
    GeotCreateCookie('geot_switcher', data.geo.city.data.zip, 999);
    if( typeof data.geo != 'undefined') {
    // create a custom cookie with zip value and 999 days duration
    GeotCreateCookie('geot_switcher', data.geo.city.data.zip, 999);

    // Add a marker in a custom google map
    if( data.geo.geolocation.data.latitude && data.geo.geolocation.data.longitude && jQuery('#geot-map').length != 0 ) {
    var stanton = {lat: parseFloat(data.geo.geolocation.data.latitude), lng: parseFloat(data.geo.geolocation.data.longitude)};
    add_marker(stanton);
    }

    }

    // Add a marker in a custom google map
    if( data.geo.geolocation.data.latitude && data.geo.geolocation.data.longitude && jQuery('#geot-map').length != 0 ) {
    var stanton = {lat: parseFloat(data.geo.geolocation.data.latitude), lng: parseFloat(data.geo.geolocation.data.longitude)};
    add_marker(stanton);
    }
    }
    });
  2. timersys created this gist May 10, 2021.
    14 changes: 14 additions & 0 deletions app.js
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,14 @@
    $(document).on('geotwp_ajax_success', function(e, data) {
    if( typeof data.geo != 'undefined') {
    // create a custom cookie with zip value and 999 days duration
    GeotCreateCookie('geot_switcher', data.geo.city.data.zip, 999);

    // Add a marker in a custom google map
    if( data.geo.geolocation.data.latitude && data.geo.geolocation.data.longitude && jQuery('#geot-map').length != 0 ) {
    var stanton = {lat: parseFloat(data.geo.geolocation.data.latitude), lng: parseFloat(data.geo.geolocation.data.longitude)};
    add_marker(stanton);
    }

    }

    });