How to get external Google Maps data as KML directly into Javascript or jQuery?

I’m working on a project where I have to grab data (markers etc.) from several external Google Maps maps. I’m writing this on the client-side in Javascript and in theory it’s all working as it should, but the problem is that when I call the KML generation url for each map using .get() or .ajax() it processes the HttpGet-request, and returns the .KML file… but it places it in the “Content-disposition: attachment; filename=file.KML” attribute of the HttpResponse.

Is there a way to get that file out of there with JS /jQuery? Reading the file itself is no problem, it’s getting it out of that ResponseHeader that is the problem since I can’t save it locally on the server.

Any ideas? Would greatly appreciate your insight!

PS: Sorry if there is a Google Maps sub-forum where this would have been more relevant to post, but the primary language I’m using it JS / jQuery so it seemed right :wink: