I would like to use vanilla JavaScript to access some MeetUp API data. I am using the following code on my website:
function addScript(src) {
console.log(src);
var s = document.createElement( 'script' );
s.setAttribute( 'src', src );
document.body.appendChild( s );
}
addScript('https://api.meetup.com/2/groups?callback=?&sign=true&member_id=8377069&page=20&api&key=API_KEY_GOES_HERE&only=name,link');
I am using a script tag to access the data to avoid cross domain issues. I appreciate this could be solved using jQuery but I do not want to use any external libs.
The above code returns this error:
Uncaught SyntaxError: Unexpected token :
I believe this is because JSON format is returned. How can I fix this but at the same time still access the JSON data. Any help much appreciated.
Example link: http://jsfiddle.net/londonfed/7ms44ft6/