I am getting an problem utilizing a wordpress produced variable in jquery. The wordpress side works fine (i suspect), however in my js i am not receiving there.

You can observe the significant code here: http://www.gport.nl/dev/pluginshop/gallery/geodata/

I am creating a flexible such as this:

$test2[] = array(
    'latitude' => $neg_lat.number_format($lat,6),
    'longitude' => $neg_lng.number_format($lng,6),
    'html' => '<img src='.$thumbnail[0].'/><p>'.$title.'</p>'
);

wp_register_script( 'backend_map_script_geo', ''.WP_PLUGIN_URL.'/magic-gallery/js/frontendmap_geo.js', null, null);
wp_enqueue_script( 'backend_map_script_geo');
wp_localize_script( 'backend_map_script_geo', 'markers', json_encode($test2));

along with the following JS:

jQuery(document).ready(function() {

    var adress_test = jQuery.parseJSON(markers);

    alert(adress_test);
    console.log(adress_test);

    var map2 = jQuery("#testmap");
        map2.gMap({

            markers: [

                adress_test

            ],

        zoom: "fit",
        latitude: "fit",
        longitude: "fit",
        onComplete: function() {
            var center = map2.data('gmap').gmap.getCenter();
        }
    });

});

The end result i am escaping . from the alert results because this:

{latitude:59.329500,longitude:18.111167,html:"<img src=http://www.gport.nl/dev/pluginshop/wp-content/uploads/2011/11/IMG_0522-100x100.jpg/><p>IMG_0522</p>"},{latitude:53.197572,longitude:5.797106,html:"<img src=http://www.gport.nl/dev/pluginshop/wp-content/uploads/2011/11/IMAG0183-100x100.jpg/><p>IMAG0183</p>"},{latitude:51.523000,longitude:0.106167,html:"<img src=http://www.gport.nl/dev/pluginshop/wp-content/uploads/2011/11/IMG_0818-100x100.jpg/><p>IMG_0818</p>"},

And this is just what I want. However, after i make use of the variable inside markers:, it doesn't work.

After I paste the code that's been notified within the JS such as this:

jQuery(document).ready(function() {

    var adress_test = backendmapparams;

    alert(adress_test);

    var map2 = jQuery("#testmap");
        map2.gMap({

            markers: [

                {latitude:59.329500,longitude:18.111167,html:"<img src=http://www.gport.nl/dev/pluginshop/wp-content/uploads/2011/11/IMG_0522-100x100.jpg/><p>IMG_0522</p>"},{latitude:53.197572,longitude:5.797106,html:"<img src=http://www.gport.nl/dev/pluginshop/wp-content/uploads/2011/11/IMAG0183-100x100.jpg/><p>IMAG0183</p>"},{latitude:51.523000,longitude:0.106167,html:"<img src=http://www.gport.nl/dev/pluginshop/wp-content/uploads/2011/11/IMG_0818-100x100.jpg/><p>IMG_0818</p>"},

            ],

        zoom: "fit",
        latitude: "fit",
        longitude: "fit",
        onComplete: function() {
            var center = map2.data('gmap').gmap.getCenter();
        }
    });

});

Everything works not surprisingly. I figure I am doing a problem, but can't appear to determine what it's. Any help could be greatly appreciated!

Use jQuery.parseJSON to decode the JSON result (it is simply a string when you are getting it)

Are the backendmapparams enclosed with quotes? Alert function wouldn't complain outputing a string, while markers would expect and object, not really a string. I am asking this if backendmapparams was really an Object, you can get [object Object] inside your alert message, and never

{latitude:59.329500,longitude:18.111167,html:"<img src=http://www.gport.nl/dev/pluginshop/wp-content/uploads/2011/11/IMG_0522-100x100.jpg/><p>IMG_0522</p>"},{latitude:53.197572,longitude:5.797106,html:"<img src=http://www.gport.nl/dev/pluginshop/wp-content/uploads/2011/11/IMAG0183-100x100.jpg/><p>IMAG0183</p>"},{latitude:51.523000,longitude:0.106167,html:"<img src=http://www.gport.nl/dev/pluginshop/wp-content/uploads/2011/11/IMG_0818-100x100.jpg/><p>IMG_0818</p>"},

the industry String.