Building an App with jQuery and JAXER

1,238 views

Published on

Don Albrecht presented this talk at the March 2009 JS.Chi() JavaScript meetup

Published in: Technology
1 Comment
0 Likes
Statistics
Notes
  • You are returning another id than you are inserting..
       Reply 
    Are you sure you want to  Yes  No
    Your message goes here
  • Be the first to like this

No Downloads
Views
Total views
1,238
On SlideShare
0
From Embeds
0
Number of Embeds
57
Actions
Shares
0
Downloads
11
Comments
1
Likes
0
Embeds 0
No embeds

No notes for slide

Building an App with jQuery and JAXER

  1. 1. Building an App with jQuery & Jaxer Javascript to do it all... Don Albrecht dalbrecht@getcollc.com
  2. 2. How It Works Don Albrecht dalbrecht@getcollc.com
  3. 3. What is Jaxer Jaxer Core Jaxer Framework ● ● Server-side browser JS based ● ● environment Marshalling ● (Spider-Monkey) Access to server ● Useful Server ● libraries. Extensions Don Albrecht dalbrecht@getcollc.com
  4. 4. Why Jaxer Improve perceived performance by migrating ● some progressive enhancement to the server Prevent replication of code between front end ● and back end. Mash ups ● Aspects ● Don Albrecht dalbrecht@getcollc.com
  5. 5. Running Code Normal Markup passes through un-executed. ● Add the runat=”” attribute to script tags. ● runat=”server” : server only – runat=”both” : code available on both client and – server. Don Albrecht dalbrecht@getcollc.com
  6. 6. Proxy Server side functions can be proxied to the ● client side. Function x() {} x.proxy=true; ● When x is called on the client, a synchronous ● call is made to the server where x is executed and it's response is returned as json. Don Albrecht dalbrecht@getcollc.com
  7. 7. Setting Up The Database <script runat=”server” type=”text/javascript”> var sql = quot;CREATE TABLE IF NOT EXISTS users quot;+ quot;(user_id INTEGER NOT NULLquot; + quot;, username VARCHAR(45)quot; + quot;, password VARCHAR(45)quot; + quot;); quot;; Jaxer.DB.execute(sql); </script> Don Albrecht dalbrecht@getcollc.com
  8. 8. Registering A User <script src=quot;lib/md5.jsquot; type=quot;text/javascriptquot; runat=quot;serverquot;></script> <script src=quot;lib/jquery/jquery-1.3.2.min.jsquot; type=quot;text/javascriptquot; runat=quot;bothquot;></script> <script type=”text/javascript” runat=”server”> function createLogin( username, password){ var passhash = hex_md5( password ); var userId = createId(); var resultset = Jaxer.DB.execute(quot;Insert Into users (user_id, username, password) VALUES( ?, ?, ? );quot; , [createId(), username, passhash]); return userId; } createLogin.proxy = true; </script> Don Albrecht dalbrecht@getcollc.com
  9. 9. Code.... Don Albrecht dalbrecht@getcollc.com
  10. 10. Code & Slides Available At: AjaxBestiary.com Don Albrecht dalbrecht@getcollc.com

×