[Javascript] JavaScript to PHP variable transfer

Chris Tifer christ at saeweb.com
Thu Aug 21 13:00:06 CDT 2003


> Firstly, the client and the server are on opposite sides of a secured
> pipe -- and CGI/BIN stuff and cookies have both been shut off.
Completely.
> Non-negotiably, and forever.  I barely have the means to do
> session-variables (sans cookies), and can't rely on it because they are
> talking about
> shutting session-variables down on the server.  Anyway, session-variables
> without cookies is pretty much a useless gesture.

A session variable IS a cookie.

> Secondly, there are several thousand miles between the client machines and
> the server(s), so latency can be an issue -- and a full-fledged forms dump
> typically takes longer than merely porting one or two variables back and
> forth.  Multipled by tens of thousands of forms transactions per-day, this
> would
> be bad.

Unless you're sending back a ton of data, processing forms does not
take any longer than any other requests that I know of. And as for the
comparison of "full-fledged form" vs. "1 or 2 variables", how can you
compare
them since there is no way of just sending variables arbitrarily to a
server - at
least in the manner of what you're hoping to do.

To get any variable to a server, you're pretty much going to need to use a
form (or a querystring which is basically the same thing) unless you have an
open socket in which you can send info back and forth.


> Thirdly, there are many different scenarios governing what fields will be
> selected for transfer, and some of the fields (if sent empty) will have
> radical and wrong
> interpretations at the other end.  In essence, the same "form" is used for
> about twenty different and very complex purposes.  Simply doing a "submit"
> sends
> everything in one hellacious mass.  If these fields could be subdivided
into
> neat little clumps for each scenario, I could make lots of little forms -- 
> but the
> overlap is about 86%, and the customer spec won't tolerate reloading new
> frames with "appropriate" forms for each scenario.

I'm not sure what it is you're trying to accomplish as you're being fairly
cryptic,
but this sounds like a design issue to me.  Taking your same example of
how sending a bunch of data back and forth can be bad, choosing to send
little
bits at a time is even moreso as the processing on the server is not going
to
take as long as transfer rates between client/server.

Also, physical location (distance) really has nothing to do with transfer
rates.
You can be close to your machine, but if it has to make multiple hops, it's
going to take longer than if you were 10,000 miles away that didn't have
many
different hops.



> One of the key sticking points that this picture causes is a need to
follow
> the JavaScript DOM chains from window to window, pulling key bits off of
> different panes and then presenting them in an acceptable form to the
server
> PHP functions for accessing the various database(s) this application is
> built around.  Having a relatively painless way for PHP to interrogate
> JavaScript for both the DOM mapping and the field values on-the-fly would
> be a tremendous help, particularly as the screen content can be
selectively
> varied on a rather massive scale.
>
> Capiche?

No, I don't capiche. Does anyone else?

That being said, there is a way of remote javascripting, but I don't believe
you're going to have any luck with any browsers other than IE.

Chris Tifer
http://emailajoke.com



More information about the Javascript mailing list