transferring dom/value pairs

E

esj

let me say up front that my experience with JavaScript and "Ajax"
interactions has been horrific. There are weeks I will never get back
because of it. Whenever I encounter something so horrific that it
makes me blank my memories of the event, I find myself going back and
trying to take different approaches to understanding what happens.

This current round of experiments involves sending and receiving what
is effectively an associative array. That is, I want to send dom names
and the associated values via XMLHttpRequest calls and on return, get a
set of dom value pairs and push them back into the current environment
in the browser.

what I need to figure out how to do is associate a series of DOM's with
a button, extract the information when the button is pressed, and then
present the entire array to a CGI. On return, I would need to take the
same array from the CGI and transfer the contents into the specified
DOM's

if this is not practical, tell me so and I go do something else which
is probably more fun. If it is practical and has been implemented in
some toolkit, fantastic. It saves me some pain. If it hasn't been
implemented, well, there goes the more hours that I will never get
back. ;-)

looking forward to your educated and wonderful responses.

---eric
 
E

esj

Paul said:
My recommendations are:
for the first part of your post, Kleenex.
for the second, JSON ( http://json.org/ )

Thank you for that reply. I will look in to the both of them. With
any luck, I will be able to cut down the toolkit to the minimum I need
and let me do all of my operations on the server.

searching, I couldn't find Kleenex but I did find
http://www.mochikit.com/ as well as a few others. Since mochikit was
described as having a more Python like aspect, I'm going to look at
that more closely.

thanks again.

---eric
 
A

~A!

Paul said:
My recommendations are:
for the first part of your post, Kleenex.
for the second, JSON ( http://json.org/ )

I'm with Paul. JSON is easy for JavaScript, and there will be an esay
toolkit for whatever language you're working with on the back end. You
really should give it a shot. It's not as standard as XML just yet, but
it is coming up fast.

~A!
 
R

Richard Cornford

... , I want to send dom names and the associated values via
XMLHttpRequest calls and on return, get a set of dom value
pairs and push them back into the current environment
in the browser.
... associate a series of DOM's with a button ...
<snip>

"Dom names", "dom value pairs", "associate a series of DOM's with a
button "?

You terminology is divorced from browser scripting with javascript. You
may have some idea of what you are trying to do but everyone else is
going to have to guess. If you want help actually doing this you will
have to explain what it is you are actually trying to do.

Richard.
 
E

esj

Richard said:
(e-mail address removed) wrote:
You
may have some idea of what you are trying to do but everyone else is
going to have to guess. If you want help actually doing this you will
have to explain what it is you are actually trying to do.

what I'm trying to do is avoid writing any JavaScript yet still provide
the same degree of web page control that JavaScript provides. and yes,
I'm trying to avoid a full round-trip page reconstruction just like
JavaScript/Ajax. for what it's worth, I've gone to the same 90% case
simplification with HTML and cgi by extending aether in the akasha
project (google aether manual for a very rough idea)

in order to avoid writing JavaScript, I believe it is necessary to be
able to tell the server-side program something about the current state
of the region of interest. Region of interest can be a form, a div
area, or what ever you want to be. State is defined by keyvalue pairs.
The key is the DOM reference either full path or by ID. a full path
would be something like:

html>body>div#if_layout>div#if_body>div#btm

and id reference should be something as simple as: div#btm

associated with each key is some data element. It may be some HTML, it
may be the data inside of a form element. It really doesn't matter as
long as it's readable.

Associated with a button or some other form of screen element calling
the user to action, should be a set of keys. When that button is
pressed, the keys retrieve the data and are sent as a bundle to the
appropriate server-side action.

on return, a similar set of key value pairs would be returned and the
keys with specify where to place the data. So one could in theory
modify a small section of the web page to change what's visible etc..

That's what I'm trying to do. I've gotten some really good advice so
far or which I'm very grateful. As I have the time I'm going to
experiment with this technique. If it yields something, hooray. If it
doesn't, well there goes a few more hours I will never get back.

besides the fact that I have been burned so horribly by raw JavaScript,
what's motivating me is the desire to create a collaborative commenting
system for writers. I don't want editing because as an author, I want
to control the changes. But I do want reviewer's to comment on the
body of the text. The user interface would be something like
highlighting the information on the web page, doing some magic
incantation with the mouseto bring up a text area in a margin. They
edit their work in the text area, save it, and continue on. As an
author, I should be able to see the regions they have commented on and
the comments so I can decide to incorporate what's important.

again, web page displays document, reviewer highlights region, text
area becomes available, reviewer enters comments, comments saved,
author of use comments, author swears that reviewers are idiots.

that's what's motivating me right now. I want to build that but I
don't want to waste my time with JavaScript "quirks" if it's at all
possible.
 
E

esj

~A! said:
I'm with Paul. JSON is easy for JavaScript, and there will be an esay
toolkit for whatever language you're working with on the back end. You
really should give it a shot. It's not as standard as XML just yet, but
it is coming up fast.

again thank you. I have looked at this and it looks like a really
superior notation for communicating data elements around a network.
I'll probably use it in my Python work in preference to other
techniques.

this is much appreciated.

---eric
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,995
Messages
2,570,230
Members
46,819
Latest member
masterdaster

Latest Threads

Top