GeoNames Home | Postal Codes | Download / Webservice | About 

GeoNames Forum
  [Search] Search   [Recent Topics] Recent Topics   [Groups] Back to home page 
[Register] Register / 
[Login] Login 
About Permission denied to call method XMLHttpRequest.open  XML
Forum Index -> FAQ - frequently asked questions
Author Message
yoland



Joined: 21/08/2008 10:03:40
Messages: 2
Offline

Hi ,marc. i am foreign user.
i want find location use the longitude and latitude. But i have this problem(No Permission).


<script type="text/javascript">
var xmlHttp;

function createXMLHttpRequest(){
if(window.ActiveXObject){
xmlHttp = new ActiveXObject("Microsoft.XMLHTTP");
}
else if(window.XMLHttpRequest){
xmlHttp = new XMLHttpRequest();
}
}

function startRequest(){
createXMLHttpRequest();
try{
xmlHttp.onreadystatechange = handleStateChange;
xmlHttp.open("post", "http://ws.geonames.org/findNearbyStreetsJSON?lat=37.451&lng=-122.18", true);
xmlHttp.send(null);
}catch(exception){
alert(exception);
}
}

function handleStateChange(){
if(xmlHttp.readyState == 4){
if (xmlHttp.status == 200 || xmlHttp.status == 0){

var resp = xmlHttp.responseText;

var func = new Function("return "+resp);

var json = func();

alert("JSON's value: " + json.adminName1);
}
}
}
</script>
</head>
<body>
<input type="button" value="return ajax JSON's value"
onclick="startRequest();" />
</body>

How do i it?
Thanks
bbqfrito



Joined: 27/08/2008 22:41:30
Messages: 5
Offline

By default browsers will not let you perform XMLHttpRequests across domains using javascript. Create a proxy that queries the external webservice on your existing domain and then perform a request on your proxy.
marc



Joined: 08/12/2005 07:39:47
Messages: 4412
Offline

Yoland

This thread describes the problems and solution:
http://forum.geonames.org/gforum/posts/list/11.page

Marc

[WWW]
yoland



Joined: 21/08/2008 10:03:40
Messages: 2
Offline

thank you for you help
 
Forum Index -> FAQ - frequently asked questions
Go to:   
Powered by JForum 2.1.5 © JForum Team