 <p>Could be your result is already JSON parsed the </p> <pre><code> function getLocation(){ var name = $("#username").val(); console.log('getLocation()'); if(name != ''){ $.ajax({ type: 'GET', url: '../../' + name, async: true, success:function(data){ var marker = new L.marker(data.location); marker.addTo(map); $("#username").val(''); }, error: function(XMLHttpRequest, textStatus, errorThrown) { alert('Not found'); } }); } } </code></pre> <p>or if you obtain an array </p> <pre><code> function getLocation(){ var name = $("#username").val(); console.log('getLocation()'); if(name != ''){ $.ajax({ type: 'GET', url: '../../' + name, async: true, success:function(data){ var marker = new L.marker(data[0].location); marker.addTo(map); $("#username").val(''); }, error: function(XMLHttpRequest, textStatus, errorThrown) { alert('Not found'); } }); } </code></pre>