[jQuery] A few questions about JQUERY
I have a few questions about implementing JQUERY.
First, I am relatively new to "WEB 2.0" methods, so please be patience
with what might seem to be silly questions.
I think I need to see an example of how we might be able to use JQUERY
or better said, how we might be able to "add" it to our current
framework.
I'm done alot of reading, research, etc over last 4-5 months and it
now it seems to me that we need to take a take back into the balcony
and concentrate on framing our data layer with XML and/or JSON. In
short, how our backend server exposes its server-side API.
I have been speading time to see how I can use JQUERY for some of our
current client applications, what changes need to be done, including
how deep the changes.
So if I may illustrate a simple example today, maybe a JQUERY expert
can explain how we can use it (or not). Maybe it doesn't make sense,
which is a concern one our 3rd party developers already has expressed
yesterday. He expressed we might be spending too much time on JQUERY
since we must cater to a wide set of tools and not get locked into one
platform.
He has a good valid point, but we need to "pick one" today, hopefully
the "best" one, in order to offer some WEB 2.0 functionality in our
stock client applications.
Our system is highly server-centric. Its a RPC client/server system.
It uses a p-code server-side scripting and template technology to
render output for any connected device. It has a rich API/SDK to
access all the server-sider information and database files.
Here is a quick Example of our code that I wish to see how I can make
this "JQUERY" ready.
"Who's Online" applicaiton:
A "who.htm" Web Page Template can look like this:
<table>
<th>Node #</th><th>User Name</th><th>Time Online</th>
@LOOP.NODES@
<tr>
<td>@NODE@</td>
<td>@NODE.USER.NAME@</td>
<td>@NODE.TIME.ONLINE@</td>
</tr>
@ENDLOOP@
</table>
I should note that the template was simplified here. The real who's
online shows a lot more information, connection type, idle time,
paging options, images, the user's current activity, etc, etc, etc. I
just pick 3 fields to show per node
A server-side pcode (HTML-WHO.WCX) applet is run and it use the
template above to render the output. It will loop thru each node,
and display the node#, username and time on line. Very simple.
WCX code will look like this (pseudo code):
dim nodes as TNodeInfo
GetNodes(nodes)
Dim index as integer = 0
if TemplateInit("wc:\http\templates\who.htm")
do while TemplateExec(var)
select case ucase(var)
case "@LOOP.NODES@"
SetTemplateVar("NODE",index)
SetTemplateVar("NODE.USER.NAME",
nodes(index).user.name)
SetTemplateVar("NODE.TIME.ONLINE",
nodes(index).time.online)
inc(index)
end select
loop
end if
The code is not complete above, like checking for the last index and
ending the loop,. But the main point here is that the server will
process this and spit it out to the browser using server-side template
technology.
Currently we use a META refresh to update who's online display every X
seconds as defined by the user.
I think this might be a good example for AJAX and JQUERY but it seems
I am spending too much time learning the new JQUERY "language." I am
not 100% clear how things are done.
I think, and this is more of a question, I think I need to first
create a new WCX that creates XML or JSON output only to begin to take
advantage of JQUERY. Then second, I need to "bind" if that is the
proper JQUERY term, the JSON fields with a Table columns.
- Create a WCX "web service" that returns JSON (or XML) output
- Bind the JSON fields with the Display fields.
Does that sound correct?
If I can see a quick example of how JQUERY will be conrstructed, in
particular having it do:
- Periodic Ajax Calls
- Bind the JSON result to table elements
then that will go a long way to completing this examination.
Note: I have explored other AJAX frameworks, such as SPRY, and it had
good examples that I can relate to using similar "template looping
ideas" but in SPRY's case, it uses client-side template processing.
One concern I had was that I did see some client side performance
hits when we apply SPRY to another potential application where large
results are returned. In our server-side template driver model, the
data is cached at the server and and paged by the browser.
These is all pretty much standard design considerations. I just hope
I can see how its done with JQUERY.
I would appreciate any comments/input you may have.
TIA
---
HLS