Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8002165
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T16:16:50+00:00 2026-06-04T16:16:50+00:00

Ok, so am able to get the JSON from the PHP page, but when

  • 0

Ok, so am able to get the JSON from the PHP page, but when a user clicks on the li inside the ul#stores it does not run. it’s like the

$("ul#stores").html("");
myMarkers = {"markers": data}

is not updating and it is not able to find it in the listing and the function below does not run. Full code at end. I am not sure if this is the best way to explain my issue.

live demo @ http://brightchoice.com.au/map.html

$("ul#stores li").on("click", function(event){
            var store = $(this).text();

            $("ul#stores").hide();
            $("#storeinfo").show();
            $.each(myMarkers.markers, function(i, data){

            if(store == data.name) {
                $("#storeinfo").append("<a href='map.html'><div class='greenbar'><div class='body'><div>  <span></span> </div> <p>Back</p></div></a></div><h1>"+data.name+"</h1>"+data.phone+"<br><br>"+data.address);

                //console.log(data.address);
                //console.log(data.state); // and more
             }
            });

            //searchlistings($(this).text());

        });

FULL CODE

<script type="text/javascript">
// <![CDATA[
 $(document).ready(function(){
        //set up markers
         var myMarkers = {"markers": [{"id": 1,"name": "Belconnen","url_name": "belconnen","address": "Shop 176, 3rd Floor, Westfield Shopping Centre, Benjamin Way","suburb": "Belconnen","state": "act","postcode": 2618,"country": "Australia","phone": "(02) 6251 1838","fax": "","photo": "dcddfcb5c806b2255c611bd2d108cead.JPG","text": "","display": 1,"lat": -35.238428606,"lng": 149.065917134,"email": "tc.belconnen@telechoice.com.au","dealer_code": 63014,"region_id": 3,"type": 4}]};

//set up map options
        defaultmap();

        $("a#backtomap").on("click", function(event){
        defaultmap();
            $("ul#stores").show();
            $("#storeinfo").hide();
        });


        $("button#search").on("click", function(event){

            var postcode = $("input#postcode").val();
            $.getJSON("http://vipcashback.com/system/classes/core.php?task=postcode&mycode="+postcode, function(data) {
            $("ul#stores").html("");
              listings = {"markers": data}
                $("#map").mapmarker({
                    zoom : 10,
                    center : postcode+" australia",
                    markers : listings
                });

                $.each(myMarkers.markers, function(i, data){

                });
            });
        });

        $("ul#stores li").on("click", function(event){
            var store = $(this).text();
            alert(store);
            $("ul#stores").hide();
            $("#storeinfo").show();
            $.each(myMarkers.markers, function(i, data){

            if(store == data.name) {
                $("#storeinfo").append("<a href='map.html'><div class='greenbar'><div class='body'><div>  <span></span> </div> <p>Back</p></div></a></div><h1>"+data.name+"</h1>"+data.phone+"<br><br>"+data.address);

                //console.log(data.address);
                //console.log(data.state); // and more
             }
            });

            //searchlistings($(this).text());

        });


        function defaultmap(){
            $("#map").mapmarker({
                zoom : 3,
                center : 'Australia',
                markers : myMarkers
            });
        }

});

// ]]>
</script>
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-04T16:16:51+00:00Added an answer on June 4, 2026 at 4:16 pm

    if you’re dynamically creating elements you should use:

    $('ul#stores li).live('click',function(){ ...});
    

    live is made so future elements can be auto binded to events.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am receiving a JSON object from a PHP get request. It looks like
I am able to get the output format that I need, but not the
in the example code we're able to get events from a JSON feed by
Iam trying to return json data from codeigniter view. but my code is not
I am not able to get my jwysiwyg and Jhtmlarea text editors to work
I am able to get the feed from the spreadsheet and worksheet ID. I
I am able to get the list of 'authored' blogs for a particular user
I was able to get this working is SSRS 2008, but do to the
I am able to get nearby places but, how do i draw the places
I am able to get access_token for multiple permissions like emails, contacts, docs, etc.

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.