I'm no developer but am pretty good at copy/paste.
I'm trying to parse the Google Latitude JSON (https://latitude.google.com/latitude/apps/badge/api?user=xxxxxxxxxxxxxxxxx&type=json
) in a webpage (JavaScript). Is that possible without PHP? and if so, could you show me some example code?
I've been looking but all the examples I found use PHP.
I used the following code:
<!DOCTYPE html>
<html>
<body>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js" type="text/javascript"></script>
<script type="text/javascript">
$(function() {
// script goes here
$.getJSON('https://latitude.google.com/latitude/apps/badge/api?&user=xxxxxxxxxxxxxxxxxxx', function(data) {
alert(data.type);
});
});
</script>
</body>
</html>
This code I have tried gave an error:
3 requests ❘ 21.38KB transferred ❘ 470ms (onload: 448ms, DOMContentLoaded: 448ms)
104ms157ms209ms261ms313ms366ms418ms470ms
OPTIONS https://latitude.google.com/latitude/apps/badge/api?&user=xxxxxxxxxxxxxxxx 405 (Method Not Allowed) jquery.min.js:19
o.extend.ajax jquery.min.js:19
o.extend.get jquery.min.js:19
o.extend.getJSON jquery.min.js:19
(anonymous function) json.html:12
o.extend.ready.o.readyList jquery.min.js:19
o.extend.each jquery.min.js:12
o.extend.ready jquery.min.js:19
(anonymous function) jquery.min.js:19
XMLHttpRequest cannot load https://latitude.google.com/latitude/apps/badge/api?&user=xxxxxxxxxxxxxxxxxxxxxx. Origin h ttp://dl.dropbox.com is not allowed by Access-Control-Allow-Origin.