Coding for Jaxer
To tell the server where to execute the code, you need to add
runat attribute to
<script> blocks. This attribute has several possible
values, as follows:
- client: The code will run in the client's browser, just
runatattribute, so you can omit it for script blocks intended for the client.
- server: The code will run on the server. Furthermore, any functions defined within the script block will be cached in association with the page. These functions will not be callable from the client, as only script output is sent to the browser, but they can be called during callback processing by other server-side functions.
- both: The code will run on both the client and the server. However, any functions defined within the script block will still be cached in association with the page so that they are not directly accessible to the client, but they can be called during callback processing by other server-side functions.
Function object properties can be declared on individual functions
to control how they are managed. These can be used to override the containing
runat setting for the individual function, thus allowing for more
granular control. For instance, server-side functions can be declared
proxied so they are callable from the client side. This is achieved by specifying
proxy property on the function object. The possible values for this property
The code above groups similar functionality together, while allowing the
function to override the default
runat="server" behavior so that it
can be called from the client. This is possible because the
is present. In client scripts with no
runat attribute, the option of programmatically
changing it by setting a different
proxy value is not available.
Alternatively, the Jaxer namespace provides a useful convenient proxie property
code. It is an
Array object, so functions can be assigned using any format or
functions that are common to arrays:
Rob Gravelle combined his love of programming and music to become a software guru and accomplished guitar player. He created systems that are used by Canada Border Services, CSIS and other Intelligence-related organizations. As a software consultant, Rob has developed Web applications for many businesses and recently created a MooTools version of PHPFreechat for ViziMetrics. Musically, Rob recently embarked on a solo music career, after playing with Ivory Knight since 2000. That band was rated as one Canada's top bands by Brave Words magazine (issue #92) and released two CDs. Rob's latest, entitled KNIGHTFALL, was a collaboration between himself, the former Ivory Knight vocalist, and legendary guitarist/producer, Jeff Waters of Annihilator fame. Rob is available for short-term software projects and recording session work. to inquire, but note that, due to the volume of emails received, he cannot respond to every email. Potential jobs and praise receive highest priority!
Original: July 9, 2009