<html>
<head>
<meta content="text/html; charset=ISO-8859-1"
http-equiv="Content-Type">
</head>
<body bgcolor="#FFFFFF" text="#000000">
<div class="moz-cite-prefix">Hi Smaran,<br>
<br>
the first possibility to get around the SOP ist the
proxy-cgi-script of OpenLayers:<br>
<br>
<a class="moz-txt-link-freetext" href="http://trac.osgeo.org/openlayers/wiki/FrequentlyAskedQuestions#ProxyHost">http://trac.osgeo.org/openlayers/wiki/FrequentlyAskedQuestions#ProxyHost</a><br>
<br>
If you are using GeoExt 1.x there is another JavaScript file you
can load which takes care that all AJAX-requests done with
ExtJs/GeoExt are passed through the OpenLayers Proxy:<br>
<br>
<a class="moz-txt-link-freetext" href="http://geoext.org/lib/overrides/override-ext-ajax.html">http://geoext.org/lib/overrides/override-ext-ajax.html</a><br>
<br>
Best regards,<br>
Chris<br>
<br>
Am 17.08.2012 22:12, schrieb Smaran Harihar:<br>
</div>
<blockquote
cite="mid:CAHRZm1sUfZDtNJyQEA05fW1rMkmuhUVnERi=z0nD=b=w6XRxnQ@mail.gmail.com"
type="cite"><span
style="color:rgb(34,34,34);font-family:arial,sans-serif;font-size:13px;background-color:rgb(255,255,255)">Hi,</span>
<div
style="color:rgb(34,34,34);font-family:arial,sans-serif;font-size:13px;background-color:rgb(255,255,255)"><br>
</div>
<div
style="color:rgb(34,34,34);font-family:arial,sans-serif;font-size:13px;background-color:rgb(255,255,255)">
<div>I am returning a JSON to a GeoExt app and this is the code
that is collecting the return,</div>
<div><br>
</div>
<div> var control = new OpenLayers.Control.Click({</div>
<div> trigger: function(evt) {</div>
<div> var lonLat = evt.xy;</div>
<div> if (popup) popup.close();</div>
<div> var request = Ext.Ajax.request({</div>
<div> <span style="white-space:pre-wrap"> </span> url:"<a
moz-do-not-send="true"
href="http://128.196.142.94:9000/info?lat=" target="_blank"
style="color:rgb(17,85,204)">http://128.196.142.94:9000/info?lat=</a>"+
panel.map.getLonLatFromViewPortPx(lonLat).lat +"&lon=" +
panel.map.getLonLatFromViewPortPx(lonLat).lon,</div>
<div> disableCaching: false,</div>
<div> success: function(response) {</div>
<div> <span style="white-space:pre-wrap"> </span> var
obj = Ext.decode(response.responseText);</div>
<div> <span style="white-space:pre-wrap"> </span>
console.log(obj);</div>
<div> <span style="white-space:pre-wrap"> </span>
console.dir(obj);</div>
<div> <span style="white-space:pre-wrap"> </span>
addToPopup(lonLat, response.responseText);</div>
<div> <span style="white-space:pre-wrap"> </span> },</div>
<div> <span style="white-space:pre-wrap"> </span> failure:
function(response) {</div>
<div> <span style="white-space:pre-wrap"> </span>
console.log('server-side failure with status code ' +
response.status);</div>
<div> <span style="white-space:pre-wrap"> </span>
addToPopup(lonLat, "Server side Failure");</div>
<div> <span style="white-space:pre-wrap"> </span> } </div>
<div> //callback: myhandler</div>
<div> });</div>
<div> }});</div>
<div><br>
</div>
<div>I wish to obtain the returned JSON and then assign it to
the popUp but whenever I try to connect to the App it is
returning the following error,</div>
<div><br>
</div>
<div> OPTIONS <a moz-do-not-send="true"
href="http://128.196.142.94:9000/info?lat=55.44873046875&lon=-118.17626953125"
target="_blank" style="color:rgb(17,85,204)">http://128.196.142.94:9000/info?lat=55.44873046875&lon=-118.17626953125</a> 405
(Method Not Allowed)</div>
<div> XMLHttpRequest cannot load <a moz-do-not-send="true"
href="http://128.196.142.94:9000/info?lat=55.44873046875&lon=-118.17626953125"
target="_blank" style="color:rgb(17,85,204)">http://128.196.142.94:9000/info?lat=55.44873046875&lon=-118.17626953125</a>.
Origin null is not allowed by Access-Control-Allow-Origin.</div>
<div> test.html:222server-side failure with status code 0</div>
<div><br>
</div>
<div>If you simply pass the url `<a moz-do-not-send="true"
href="http://128.196.142.94:9000/info?lat=55.44873046875&lon=-118.17626953125"
target="_blank" style="color:rgb(17,85,204)">http://128.196.142.94:9000/info?lat=55.44873046875&lon=-118.17626953125`</a> you
will obtain the JSON but for some reason there is failure that
keeps occurring in the application.</div>
</div>
<div
style="color:rgb(34,34,34);font-family:arial,sans-serif;font-size:13px;background-color:rgb(255,255,255)"><br>
</div>
<div
style="color:rgb(34,34,34);font-family:arial,sans-serif;font-size:13px;background-color:rgb(255,255,255)">Is
there CORS that can be used in the OpenLayers or GeoExt. I have
tried using ExtJS JSON-P but I am not sure what should I enter
in the 'callback' of,</div>
<div
style="color:rgb(34,34,34);font-family:arial,sans-serif;font-size:13px;background-color:rgb(255,255,255)"><br>
</div>
<div
style="color:rgb(34,34,34);font-family:arial,sans-serif;font-size:13px;background-color:rgb(255,255,255)"><script
src="<a moz-do-not-send="true"
href="http://domainb.com/users?callback=someCallback"
target="_blank" style="color:rgb(17,85,204)">http://domainB.com/users?callback=someCallback</a>"></script></div>
<div
style="color:rgb(34,34,34);font-family:arial,sans-serif;font-size:13px;background-color:rgb(255,255,255)"><br>
</div>
<div
style="color:rgb(34,34,34);font-family:arial,sans-serif;font-size:13px;background-color:rgb(255,255,255)">Thanks,</div>
<div
style="color:rgb(34,34,34);font-family:arial,sans-serif;font-size:13px;background-color:rgb(255,255,255)">Smaran</div>
<br>
<fieldset class="mimeAttachmentHeader"></fieldset>
<br>
<pre wrap="">_______________________________________________
Users mailing list
<a class="moz-txt-link-abbreviated" href="mailto:Users@geoext.org">Users@geoext.org</a>
<a class="moz-txt-link-freetext" href="http://www.geoext.org/cgi-bin/mailman/listinfo/users">http://www.geoext.org/cgi-bin/mailman/listinfo/users</a>
</pre>
</blockquote>
<br>
</body>
</html>