|
From: Ganguly, A. <aga...@so...> - 2007-10-01 23:16:02
|
Hello, I'm attempting to use the api to add and retrieve content. Saw the javascript code under http://www.connotea.org/wiki/WebAPIAuthentication =20 Basically replicated it to, =20 request =3D window.XMLHttpRequest ? new XMLHttpRequest() : new ActiveXObject("MSXML2.XMLHTTP.3.0"); if (!request) alert("Error initializing XMLHttpRequest!"); =20 var url =3D "http://www.connotea.org/data/noop"; =20 request.open("GET", url, true); --------------------------fails here request.setRequestHeader("Authorization", "Basic"+btoa(login+":"+password)); request.onreadystatechange =3D handleResponse; request.send(null); =20 handle Response is this, =20 if (request.readyState =3D=3D 4) if (request.status =3D=3D 200) alert("Server is done!"); else if (request.status =3D=3D 404) alert("Request URL does not exist"); else alert("Error: status code is " + request.status);=20 =20 =20 Now it seems like request.open only works on files on the localhost. If that's true connotea will always return a 'permission denied to call open()'. =20 Is there a way around this? The goal is to do any authentication/ response handling in the background w/o showing any of the ugly response headers. =20 I expect to run into a similar issue on trying to do a post request using HttpRequest. =20 Can someone help please. =20 Arindam Ganguly Calit2, UCSD =20 =20 |