Implement AJAX in App Engine

32 views
Skip to first unread message

Shay Ben Dov

unread,
Oct 12, 2008, 4:06:52 AM10/12/08
to Google App Engine
I wonder is there a way to implement AJAX in an application like the
easy way it is done in Rails:

you write 1 line in the header to include Javascript, defaults and
other

then you issue a simple command in your HTML body like:

<div id="alerts">

</div>
<%= periodically_call_remote(:update => 'alerts',
:url => { :controller => :alerts,
:action => :listen_for_requests },
:frequency => 10 )%>
to issue a call to the server in the background.

Enabling this kind of capabilities will make life easier and speed-up
development

David Symonds

unread,
Oct 13, 2008, 7:00:53 AM10/13/08
to google-a...@googlegroups.com
On Sun, Oct 12, 2008 at 7:06 PM, Shay Ben Dov <shay....@gmail.com> wrote:

> I wonder is there a way to implement AJAX in an application like the
> easy way it is done in Rails:
>
> you write 1 line in the header to include Javascript, defaults and
> other
>
> then you issue a simple command in your HTML body like:

App Engine is really a much lower level platform than that. You could
probably write your own AJAX stuff like you suggest using JavaScript,
being helped out by a library like jQuery.


Dave.

Message has been deleted

Shay Ben Dov

unread,
Oct 24, 2008, 6:05:02 AM10/24/08
to Google App Engine
If you can point to RIA source code that updates continuously the time
or the status of inventory levels

It will be very helpful

thanks

Shay Ben Dov


On Oct 13, 9:21 pm, Davide Rognoni <davide.rogn...@gmail.com> wrote:
> "Ajax Requests"http://docs.jquery.com/Ajax
>
> "setInterval(func, interval, [args])"
> Calls the specified "func" (or aJavaScriptstatement) repeatedly per
> the "interval" interval, in milliseconds (ie: 1000=every 1 second).
> "func" must be surrounded in quotations, as if it was a string. Use
> the optional "args" to pass any number of arguments to the function.http://www.javascriptkit.com/jsref/window.shtml
>
> On Oct 13, 1:00 pm, "David Symonds" <dsymo...@gmail.com> wrote:

Bill

unread,
Oct 24, 2008, 11:49:22 AM10/24/08
to Google App Engine
There are at least two things you'd want to do in your case:

1) Figure out the necessary javascript to periodically issue AJAX
calls. This will be dependent on the javascript framework (if any)
you chose.

2) Setup a Django template helper to insert that javascript when the
App Engine server parses your template file. See this cookbook
recipe:
http://appengine-cookbook.appspot.com/recipe/using-custom-django-template-helpers/?id=ahJhcHBlbmdpbmUtY29va2Jvb2tyjgELEgtSZWNpcGVJbmRleCI4YWhKaGNIQmxibWRwYm1VdFkyOXZhMkp2YjJ0eUZBc1NDRU5oZEdWbmIzSjVJZ1pFYW1GdVoyOE0MCxIGUmVjaXBlIjlhaEpoY0hCbGJtZHBibVV0WTI5dmEySnZiMnR5RkFzU0NFTmhkR1ZuYjNKNUlnWkVhbUZ1WjI4TTAM

A lengthy intro to template helpers is here:
http://docs.djangoproject.com/en/dev/howto/custom-template-tags/

And I recently discovered these rails helpers but haven't used them
yet:
http://code.google.com/p/django-helpers/

-Bill
Message has been deleted

Shay Ben Dov

unread,
Oct 24, 2008, 8:49:45 PM10/24/08
to Google App Engine
Thanks for the tip.

I've developed what I've intended. I used the following:

function functionName(){

new new Ajax.Updater('div id', '/action_name', {
method: 'get'

});

}

setInterval("functionName()", 3000)

When the application will be ready I'll let you know

Again thanks

Shay Ben Dov

On Oct 13, 9:21 pm, Davide Rognoni <davide.rogn...@gmail.com> wrote:
> "Ajax Requests"http://docs.jquery.com/Ajax
>
> "setInterval(func, interval, [args])"
> Calls the specified "func" (or a JavaScript statement) repeatedly per
> the "interval" interval, in milliseconds (ie: 1000=every 1 second).
> "func" must be surrounded in quotations, as if it was a string. Use
> the optional "args" to pass any number of arguments to the function.http://www.javascriptkit.com/jsref/window.shtml
>
> On Oct 13, 1:00 pm, "David Symonds" <dsymo...@gmail.com> wrote:
>

Shay Ben Dov

unread,
Oct 24, 2008, 9:08:03 PM10/24/08
to Google App Engine
The method I used doesn't work on IE 6.

If someone can verify that it works on IE 7 I'm not using it

or if I can get a guidance to make it compatible with IE it will be
excellent.

The reference I used is: http://www.tutorialized.com/view/tutorial/Prototype-and-AJAX-Tutorial/35281

The example is working on IE 6 the problem is probably with
setInterval

On Oct 13, 9:21 pm, Davide Rognoni <davide.rogn...@gmail.com> wrote:
> "Ajax Requests"http://docs.jquery.com/Ajax
>
> "setInterval(func, interval, [args])"
> Calls the specified "func" (or a JavaScript statement) repeatedly per
> the "interval" interval, in milliseconds (ie: 1000=every 1 second).
> "func" must be surrounded in quotations, as if it was a string. Use
> the optional "args" to pass any number of arguments to the function.http://www.javascriptkit.com/jsref/window.shtml
>
> On Oct 13, 1:00 pm, "David Symonds" <dsymo...@gmail.com> wrote:
>

Shay Ben Dov

unread,
Oct 25, 2008, 3:58:26 AM10/25/08
to Google App Engine
************ sorry in the example I made a mistake:

It should be 1 new and not
new new Ajax.Updater('div id', '/action_name', {

now on IE 6 we don't get an error message
but it is not doing the ajax stuff with the setInterval

on Chrome Firefox and Flock it is working fine.

On Oct 25, 3:08 am, Shay Ben Dov <shay.ben...@gmail.com> wrote:
> The method I used doesn't work on IE 6.
>
> If someone can verify that it works on IE 7 I'm not using it
>
> or if I can get a guidance to make it compatible with IE it will be
> excellent.
>
> The reference I used is:http://www.tutorialized.com/view/tutorial/Prototype-and-AJAX-Tutorial...

Arun Shanker Prasad

unread,
Oct 25, 2008, 4:36:58 AM10/25/08
to Google App Engine
Hi,
Have you tried setTimeout()? It does the same thing and it works for
me in most ie versions.
Message has been deleted

Shay Ben Dov

unread,
Oct 25, 2008, 10:38:18 AM10/25/08
to Google App Engine
Thanks but to master GWT is not a joy.

I think part of the problem is related to CSS compatibility issues in
IE 6 you can spot that the program span <div but doesn't show the data
written by the program.

Anyhow CSS differences is also a complicated issue.

Any guidance is appreciated.

Shay Ben Dov


On Oct 25, 1:43 pm, RIAgallery <davide.rogn...@gmail.com> wrote:
> I think the best way will be:
>
> "Google Web Toolkit 1.5"http://code.google.com/docreader/#p=google-web-toolkit-doc-1-5
>
> Enjoy ;-)

Shay Ben Dov

unread,
Oct 28, 2008, 3:54:17 PM10/28/08
to Google App Engine
Hi,

The ajax implementation works on IE 6 when I access my application on
the GAE and not on the dev_appserver.py

probably timing problem on the dev pc whenever I was trying to run 2-3
different browsers on the same pc including IE.

Thanks for the help from all of you.

The application http://cmyquest.appspot.com

See you all

Shay Ben Dov
Reply all
Reply to author
Forward
0 new messages