That got me on the right track. Thanks!
On Sunday, April 8, 2012 12:24:58 PM UTC-7, Anthony wrote:
>
>
>> function serialRead() {
>> var msg = "<p>{{=serialRead()}}</p>";
>> $('#console').append(msg);
>> }
>>
>
> You are attempting to mix Python (which runs on the server) with
> Javascript (which runs on the client). The above is a template that web2py
> converts into HTML and sends to the browser. When the template is executed,
> {{=serialRead()}} is replaced with the value returned by calling the
> serialRead() function -- so the Javascript sent to the browser simply
> contains a fixed value in that place (i.e., the server-side serialRead
> function is called only once, when the page is initially rendered by
> web2py). If you want to repeatedly call a Python function on the server
> from the client (without completely reloading the page), you'll need to
> make Ajax calls to the server. For details on that, see
> http://web2py.com/books/default/chapter/29/11.
>
> If you move your serialRead() function to the default.py controller, you
> could do something like this:
>
> function serialRead() {
> ajax("{{=URL('default', 'serialRead')}}", [], "console");
> };
>
> The ajax call makes a request to the /defaul/serialRead URL and places the
> returned result into the element with id="console".
>
> Anthony
>
>