Right now I can use this URL to request a Google Static Maps image successfully:
http://maps.google.com/staticmap?center=37.687,-122.407&zoom=8&size=450x300&maptype=terrain&key=[my key here]&sensor=false
However, the second I use jQuery or any direct javascript to set the src image to the above URL, Google returns a 400 error:
"Your customer has issued an incorrect or illegal request."
I read that this is usually due to the wrong key, but my key is explicitly being passed.
This is how I dynamically set the image:
document.getElementById('my-image-id').src = "http://maps.google.com/staticmap?center=37.687,-122.407&zoom=8&size=450x300&maptype=terrain&key=[my key here]&sensor=false"
I replaced [my key here] with my correct key, and it still does not work. When I request the same URL through the browser, everything is fine. I confirmed that the right sources also pass.
Any ideas?