i wont create MapData for jvectormap from database, like this
{"AP":3,"DE":1,"GB":2,"ID":24,"US":10}
but my code always return like this
["{\"AP\":3}","{\"DE\":1}","{\"GB\":2}","{\"ID\":24}","{\"US\":10}"]
this my javascript
    $(document).ready(function () {
    var mapData ={} 
               $.ajax({ url: '/orders/map', type: 'GET', dataType: 'json' }).success(function (data) {
               mapData = (data);
            });
    var dd =    JSON.stringify( mapData, null, '\t'); 
        $('#world-map').vectorMap({
            map: 'world_mill_en',
            regionStyle: {
                initial: {
                    fill: '#e4e4e4',
                    "fill-opacity": 1,
                    stroke: 'none',
                    "stroke-width": 0,
                    "stroke-opacity": 0
                }
            },
            series: {
                regions: [{
                    values: dd,
                    scale: ["#1ab394", "#22d6b1"],
                    normalizeFunction: 'polynomial'
                }]
            },
            onRegionTipShow: function (e, el, code) {
                console.log(dd[code]);
                    var mapcode = ( dd[code] ) ? ' ( ' + dd[code] + ' Visitor/Visitors  )' : ' ( No visitor yet! )';
                el.html(el.html() + mapcode );
            }
        });
    }); 
this my codeigniter controllers
        function map(){
        $rows = array();
        $query = $this->db->query('SELECT country, COUNT(1) AS rpt_count FROM vistors GROUP BY country');   
        foreach($query->result() as $row)
        {    
        $rows[] = '{"'.$row->country.'":'.$row->rpt_count.'}';
        }      
    $this->output
        ->set_content_type('application/json')
        ->set_output(json_encode($rows));
        }
comebody can help me please
 
     
    