Welcome to the Java Programming Forums


The professional, friendly Java community. 21,500 members and growing!


The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.


>> REGISTER NOW TO START POSTING


Members have full access to the forums. Advertisements are removed for registered users.

Results 1 to 4 of 4

Thread: Review my code

  1. #1
    Junior Member
    Join Date
    Jul 2019
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Review my code

    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";
    }
    });
    });

  2. #2
    Super Moderator Norm's Avatar
    Join Date
    May 2010
    Location
    Eastern Florida
    Posts
    25,042
    Thanks
    63
    Thanked 2,708 Times in 2,658 Posts

    Default Re: Review my code

    The posted code does not look like java.
    If you don't understand my answer, don't ignore it, ask a question.

  3. #3
    Junior Member
    Join Date
    Jul 2019
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Re: Review my code

    Quote Originally Posted by Norm View Post
    The posted code does not look like java.
    That's tells you how much I know. Its from a js file, does that help?

  4. #4
    Super Moderator Norm's Avatar
    Join Date
    May 2010
    Location
    Eastern Florida
    Posts
    25,042
    Thanks
    63
    Thanked 2,708 Times in 2,658 Posts

    Default Re: Review my code

    js usually means javascript. Try your question on a javascript forum.
    If you don't understand my answer, don't ignore it, ask a question.

Similar Threads

  1. Where to post my code for review.
    By AwesomePilot in forum Totally Off Topic
    Replies: 1
    Last Post: March 16th, 2018, 08:56 AM
  2. Replies: 0
    Last Post: November 21st, 2013, 08:08 AM
  3. Kindly Review My Code :-) Thanks in advance
    By bhuppi in forum What's Wrong With My Code?
    Replies: 1
    Last Post: April 27th, 2012, 10:10 AM
  4. [SOLVED] Please Review My Code (Long Integer Addition)
    By Saradus in forum Java Theory & Questions
    Replies: 10
    Last Post: July 4th, 2009, 12:55 PM