Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>You access a back end with a url like <a href="http://instance.backend.appid.appspot.com" rel="nofollow">http://instance.backend.appid.appspot.com</a> (see <a href="http://code.google.com/appengine/docs/python/backends/overview.html#Addressing_Backends" rel="nofollow">the docs</a>). Since you can't make an XHR to a page like this from an page rendered on <a href="http://appid.appspot.com" rel="nofollow">http://appid.appspot.com</a>, you have basically two options:</p> <p>You can marshal the request to your backend via a servlet on your frontend. So you could do something like:</p> <pre><code>class MarshalServlet(RequestHandler): """ This class is part of your frontend. """ def post(self, instance, backend): # generate an urlfetch request to http[s]?://instance.backend.appid.appspot.com # and return its result. # (left as an exercise for the reader) # add a "dashboard" handler to your frontend application. app = webapp.WSGIApplication([('/dashboard/', MarshalServlet), # other servlets etc. ], debug=True) </code></pre> <p>Or you could use JSONP to do a cross-domain request, which is easy with <a href="http://api.jquery.com/jQuery.getJSON/" rel="nofollow">jQuery's getJSON method</a>:</p> <pre><code>$.getJSON("http://instance.backend.appid.appspot.com/dashboard/", function() { alert("success"); }); </code></pre> <p>It's not clear to me what your /dashboard/ handler does, so I'm not sure if it can/should return JSON or if you care about the headers and so on.</p> <p>Also note that using the getJSON method won't send along cookies, but you could do that with a marshaling servlet.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload