<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>&nbsp; &nbsp; var control = new OpenLayers.Control.Click({</div>
        <div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp;trigger: function(evt) {</div>
        <div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; var lonLat = evt.xy;</div>
        <div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if (popup) popup.close();</div>
        <div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; var &nbsp;request = Ext.Ajax.request({</div>
        <div>&nbsp; &nbsp;&nbsp;<span style="white-space:pre-wrap"> </span>&nbsp;&nbsp; &nbsp; &nbsp;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 +"&amp;lon=" +
          panel.map.getLonLatFromViewPortPx(lonLat).lon,</div>
        <div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; disableCaching: false,</div>
        <div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; success: function(response) {</div>
        <div>&nbsp; &nbsp;&nbsp;<span style="white-space:pre-wrap"> </span>&nbsp;&nbsp; &nbsp; &nbsp;var
          obj = Ext.decode(response.responseText);</div>
        <div>&nbsp; &nbsp;&nbsp;<span style="white-space:pre-wrap"> </span>&nbsp;&nbsp; &nbsp;
          &nbsp;console.log(obj);</div>
        <div>&nbsp; &nbsp;&nbsp;<span style="white-space:pre-wrap"> </span>&nbsp;&nbsp; &nbsp;
          &nbsp;console.dir(obj);</div>
        <div>&nbsp; &nbsp;&nbsp;<span style="white-space:pre-wrap"> </span>&nbsp;&nbsp; &nbsp;
          &nbsp;addToPopup(lonLat, response.responseText);</div>
        <div>&nbsp; &nbsp;&nbsp;<span style="white-space:pre-wrap"> </span>&nbsp;&nbsp; &nbsp; &nbsp;},</div>
        <div>&nbsp; &nbsp;&nbsp;<span style="white-space:pre-wrap"> </span>&nbsp;&nbsp;failure:
          function(response) {</div>
        <div>&nbsp; &nbsp;&nbsp;<span style="white-space:pre-wrap"> </span>&nbsp;&nbsp; &nbsp;
          &nbsp;console.log('server-side failure with status code ' +
          response.status);</div>
        <div>&nbsp; &nbsp;&nbsp;<span style="white-space:pre-wrap"> </span>&nbsp;&nbsp; &nbsp;
          &nbsp;addToPopup(lonLat, "Server side Failure");</div>
        <div>&nbsp; &nbsp;&nbsp;<span style="white-space:pre-wrap"> </span>&nbsp;&nbsp;} &nbsp;</div>
        <div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;//callback: myhandler</div>
        <div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;});</div>
        <div>&nbsp; &nbsp; }});</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>&nbsp; &nbsp; OPTIONS&nbsp;<a moz-do-not-send="true"
href="http://128.196.142.94:9000/info?lat=55.44873046875&amp;lon=-118.17626953125"
            target="_blank" style="color:rgb(17,85,204)">http://128.196.142.94:9000/info?lat=55.44873046875&amp;lon=-118.17626953125</a>&nbsp;405
          (Method Not Allowed)</div>
        <div>&nbsp; &nbsp; XMLHttpRequest cannot load&nbsp;<a moz-do-not-send="true"
href="http://128.196.142.94:9000/info?lat=55.44873046875&amp;lon=-118.17626953125"
            target="_blank" style="color:rgb(17,85,204)">http://128.196.142.94:9000/info?lat=55.44873046875&amp;lon=-118.17626953125</a>.
          Origin null is not allowed by Access-Control-Allow-Origin.</div>
        <div>&nbsp; &nbsp; 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&amp;lon=-118.17626953125"
            target="_blank" style="color:rgb(17,85,204)">http://128.196.142.94:9000/info?lat=55.44873046875&amp;lon=-118.17626953125`</a>&nbsp;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)">&lt;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>"&gt;&lt;/script&gt;</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>