javascript - jQuery getJSON won't work on cross domain -


i'm trying use google maps' rest api convert typed in adress coordinates. use jquery's getjson function uses native jsonp call.

though won't work, doesn't success, alert never called.

$("#makecords").click(function(){     straat = $('#straat').val();     stad = $('#stad').val();     land = $('#country').val();     if(straat == "" || stad == "" || land == ""){         alert("onvoldoende gegevens! vul straat, stad en land aan voor het gebruik van de ´bereken coordinaten´ functie.");     }else{         $.getjson("http://maps.google.com/maps/api/geocode/json?callback=?",         {             adress: straat +", " + stad +", " + land,             sensor: "false"         },           function(data) {               alert(data);           });     } }); 

the google maps geocoding api not support json-p; ignore callback parameter, cross-domain json-p won't work.

you should use official google maps javascript library instead. internally library use json-p pass information (since it's almost way cross-domain requests), url reserved official library use only.


Comments

Popular posts from this blog

c++ - Is it possible to compile a VST on linux? -

c# - SharpSVN - How to get the previous revision? -

php cli reading files and how to fix it? -