Distant data I attempt to retrieve with JSON.
[{"lat":"42.361730","lon":"-71.131594"}]
My javascript code which currently returns error.
var pins = $.ajax({
type: 'GET',
url: server_url,
async: false,
data: { q_type: 6 },
dataType: 'jsonp',
jsonp: 'jsoncallback',
success: function(data) { return data; },
error: function() { alert('Load error'); }
});
My php script
echo $_GET['jsoncallback'] . '[' . json_encode($new) . ']';
Here I know it should be parentheses but if I don't put brackets pins do not load. So I have to find a way to change parentheses by brackets when I send them through json.