I've been building some AJAX clients that call App Engine backends.
I'm not sure what documentation your citing, but App Engine is just
like any server out there.  The standard webapp framework nicely
handles GET, POST, and other HTTP actions/verbs.  You can set the
content header in your handler by doing this:

self.response.headers['Content-Type'] = 'text/javascript'   # or
'application/json' if you think IE won't choke on it
self.response.out.write(...some json...)

That's it.  The hard part on the backend is the code that autoconverts
datastore structures into json.  In particular, you have to convert
datetime and recurse down into lists and dictionaries and convert them
to simple json types.

On Sep 8, 8:42 pm, Downtown <[EMAIL PROTECTED]> wrote:
> Hi,
>
> I am attempting to write a GAE application using AJAX.  It states:
>
> "In its most generic sense, an AJAX Request will have a function name
> followed by any optional parameters, the last of which, if it is a
> function, is an optional OnSuccess callback. So, lets write a function
> that handles this:
>
> .........
> (resulting in ......)
>
> GEThttp://localhost:8080/rpc?action=Add&arg0=%221%22&arg1=%222%22&time=1...
> ...."
>
> Where is the "OnSuccess" callback??  It is missing from the GET URL.
> Can I assume the following is correct:
>
> GEThttp://localhost:8080/rpc?action=Add&arg0=%221%22&arg1=%222%22&time=1...
>
> Also, can I assume on the server side:
>
> self.response.out.write(simplejson.dumps(result)).......will send the
> response to myjavascriptfunction??
>
> If I am missing something fundamental, please explain.  If not, please
> update the example to include better documentation on the callback
> function.
>
> P.S.  If you help me fine tune your example I will post a Dojo
> equivalent that would substantially reduce coding the AJAX GET.  In
> Dojo it would be as simple as:
>
>  dojo.io.script.get({
>                         url: "http://localhost:8080/rpc?";,
>                         content: {
>                             action: "Add",
>                             arg0: "1",
>                             arg2: "2",
>                            time: Date(),
>                            OnSuccess: "myjavascriptfunction"
>                         },
>                         handleAs: "text/json",
>                         preventCache: true,
>                         error: function(text){
>                             alert("An error has occurred - " + text);
>                             return text;
>                         }
>                     });
>                 }
>
> Thanks!
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Google App Engine" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/google-appengine?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to