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 8664077
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T17:09:18+00:00 2026-06-12T17:09:18+00:00

When I view JSON data as an alert when the page loads, I see:

  • 0

When I view JSON data as an alert when the page loads, I see:

[
    "Ankida Ridge Vineyards – The Vrooman Family Vineyard & Winery",
    37.69603499999999,
    -79.17580859999998,
    "<div id=\"post-45\"><a href=\"http://localhost/jhtwp/business/ankida-ridge-vineyards-the-vrooman-family-vineyard-winery/\">Ankida Ridge Vineyards &#8211; The Vrooman Family Vineyard &#038; Winery</a></div>"
]

which passes on JSONlint. In my source data however, I see this:

/* <![CDATA[ */
var busipress_map_vars = [];
busipress_map_vars = {"default_map_icon":"http:\/\/localhost\/jhtwp\/wp-content\/plugins\/busipress\/img\/red-dot.png","default_map_icon_width":32,"default_map_icon_height":32,"active_map_icon":"http:\/\/localhost\/jhtwp\/wp-content\/plugins\/busipress\/img\/blue-dot.png","active_map_icon_width":32,"active_map_icon_height":32,"map_icon_shadow":"http:\/\/localhost\/jhtwp\/wp-content\/plugins\/busipress\/img\/msmarker.shadow.png","map_icon_shadow_width":59,"map_icon_shadow_height":32,"center_lat":-34.397,"center_long":150.644,"path_start":"35.7719444, -78.6388889","path_end":"32.7763889,  -79.9311111","locations":"[\"Ankida Ridge Vineyards &#8211; The Vrooman Family Vineyard &#038; Winery\",37.69603499999999, -79.17580859999998, \"<div id=\\\"post-45\\\"><a href=\\\"http:\/\/localhost\/jhtwp\/business\/ankida-ridge-vineyards-the-vrooman-family-vineyard-winery\/\\\">Ankida Ridge Vineyards &#8211; The Vrooman Family Vineyard &#038; Winery<\/a><\/div>\"]"};;
/* ]]> */
</script>

which is escaping the double-quotes (there’s some other data in there that works fine). I have the following function that generates each location:

function busipress_business_teaser($echo = true, $zindex) {

    $location = get_field('address');

    $location_array = explode(',',$location['coordinates']);

    ob_start();
    echo '["';
    echo get_the_title();
    echo '",';
    echo $location_array[0] . ', ';
    echo $location_array[1] . ', ';
    echo '"<div ';
    echo 'id=\"post-'.get_the_ID().'\">';
    echo '<a href=\"'.get_permalink().'\">';
    echo get_the_title();
    echo '</a>';
    echo '</div>"';
    echo ']';
    $display = ob_get_contents();

    ob_end_clean();

    if($echo) {
        echo $display;
    }
    else {
        return $display;
    }

}

am I creating this data the wrong way? Using this withe Google Maps API v3. Thanks!

  • 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-12T17:09:19+00:00Added an answer on June 12, 2026 at 5:09 pm

    I think your function should look like this

    function busipress_business_teaser($echo = true, $zindex) {
        $location = get_field('address');
        list($lat,$log) = explode(',',$location['coordinates']);
    
        $json = array();
        $json[]=  get_the_title();
        $json[] = $lat ;
        $json[] = $log ;
        $json[] = sprintf('<div id=\"post-%d\"><a href=\"%s\">%s</a></div>',get_the_ID(),get_permalink(),get_the_title());
        return json_encode($json);
    }
    

    If you want to work with Goolge MAP they are enough PHP class to do just that

    • PHP-Display-Maps-using-Google-Maps-API-version-3
    • PHP-Display-world-locations-using-Google-maps
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have 5 view which have deferent json data , in all my 5
I am populating the list view with data I am getting from a JSON
$(function(){ $.getJSON('http://pipes.yahoo.com/pipes/pipe.run?_id=7ba696f34ae17b6fa8f5d4de13064dea&_render=json&callback=?',function(data){alert('called')}); }); i am using the above code to acess the a yahoo
I find it inconvenient using my browser to view JSON responses, then copy/paste the
I created a custom view that uses Json.Simple to serialize the model and write
I have a view model coming from the server as json like this {
I am trying to output JSON directly in my Razor view. The object being
I have a view that I want to be converted into JSON. What is
I'm returning JSON from my controller to my view in order to populate a
I have a View (created using Backbone.View.extend) and a JSON object, I actually get

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.