Use String Variables in Name Value Pair Argument Lists
I am relatively new to jquery and am trying set up a gmap to display markers on the map via an AJAX call. I can get the map working if I hard code the name value pair arguments as follows:
- $('.gmap').gMap({
- zoom: 9, markers: [
- { address: "8539 Spencer Court, Orlando, FL 32817" },
- { address: "400 Market Street, Wisconsin Rapids, WI 54494" }
- ]
- });
The AJAX routine returns a string imitating the layout between the markers: [ ] square brackets as follows:
- { address: "8539 Spencer Court, Orlando, FL 32817" },
- { address: "400 Market Street, Wisconsin Rapids, WI 54494" }
Is there any way to make the string that is returned from my AJAX call the value in the markers name/value pair? Kind of like this (the non-working portion of my code):
- $.post(pubRoot+'ajax/get_jq_google_map_markers.php', function(data){
- strData = ""+data;
- $(objMap).gMap({ markers: [ strData ] });
- });
Any advice or insight is greatly appreciated!