Looking at that last line of php code:
echo "var latlong = " . (!empty($data) ? json_encode($data) : "]") . ";";
Suppose the array is empty? Your output would be:
var latlong = ];
which is obviously an error and could cause collateral mischief in other javascript.
Suppose it's not:
If you build the page with the javaScript before the page is served they're part of the page. Use as normal.
If, however, you put javaScript on your page with AJAX, be aware that new javaScript may not be actually available to your page if you just render the text.
Let's assume callback() already exists:
It's getting what you'd expect[^] form JSON formed from a non-associative array. By this I mean you do not have indices.
You'll find this in the linked page:
Quote:
Non-associative array output as array: [[1,2,3]]
Non-associative array output as object: {"0":{"0":1,"1":2,"2":3}}
Hope this helps you find your missing int's (i.e., If I understand you correctly)