471,119 Members | 1,085 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,119 software developers and data experts.

Javascript V ASP

dear all,

does a client side script always need a server side script in order to
function?

how can i get my javascript application to send the details of a user
filled form to me without having to have a server side script?

if i have both server side and client side script in a web
application, will the resulting application run as a client or server?

i know i probably haven't made much sense, but the problem is that i'm
trying to make sense of it all.
thanks guys xxx
Jul 23 '05 #1
3 1255
li*******@yahoo.co.uk (Liza) writes:
does a client side script always need a server side script in order to
function?
No.
Client side scripts and server side scripts are completely unrelated.

When a browser requests a page that contains server side scripts,
the scripts are run, like a program, on the server. The result
of running this on the server is an HTML page, that is: text.
When the browser receives the page, the server side scripts have
all finished running, like programs that have ended. The only
sign that they have ever run is the resulting page.

That page may, or may not, contain client side scripts. When the
browser receives the page, it runs the client side scripts. Such
scripts can manipulate how the page looks in the browser, but
they rarely try to contact the server except by making the browser
request a new page.

Client side scripts are very restrained in what they can do. They
can't access files on the computer, nor contact other servers over
the net. They are just running inside the browser. This is a security
measure, since you can't know which scripts to trust.
how can i get my javascript application to send the details of a user
filled form to me without having to have a server side script?
Sending a form is easy, just press submit. It's doing something with
the data that takes scripting. The easiest place to do something about
it is at the server, because server side scripts are not restrained
the same way client side scripts are. A server side script would
be able to send the submitted form to you as an e-mail.

On the client, the best you can do is to make the action of the form
a mailto: link, and that's not a very good solution.
if i have both server side and client side script in a web
application, will the resulting application run as a client or server?
I'm afraid that questions doesn't make sense to me, perhaps because
I'm not sure what is part of the "application".

The web server is a server. The browser is a client. The scripts at
either end manipulate data locally at that end, and communication
between the two ends is HTTP requests and responses.
i know i probably haven't made much sense, but the problem is that i'm
trying to make sense of it all.


Good luck :)

/L
--
Lasse Reichstein Nielsen - lr*@hotpop.com
DHTML Death Colors: <URL:http://www.infimum.dk/HTML/rasterTriangleDOM.html>
'Faith without judgement merely degrades the spirit divine.'
Jul 23 '05 #2
if i have both server side and client side script in a web application,
will the resulting application run as a client or server?...
Liza, we will call it server side. Because the server side script is
beyond our abilty to manipulate we think of the entire page as server
side.

Jul 23 '05 #3
trinity mail wrote:
if i have both server side and client side script in a web application,
will the resulting application run as a client or server?...
The resulting application will "run as" neither client nor server. It will
run the server-side code to produce some content which is sent to the
client. If the resulting content contains client-side Javascript, then that
Javascript is executed on the client (assuming the client understands how to
execute client-side script).
Liza, we will call it server side. Because the server side script is
beyond our abilty to manipulate we think of the entire page as server
side.


This makes entirely no sense to me.

If this is the case, then _all_ Web pages are "server side" (which is true
given the definition above), because you have no ability to edit the static
HTML pages (on the server) sent to you either.

You have to separate your thinking into "what happens on the server" and
"what happens on the client".

Starting with the client first (because I hope it will make more sense to
you this way): the client makes a request to a Web server and receives some
"text/html" content from a Web server (it can receive other types of
content, but let's keep it simple with text/html). It does not matter if
that content is a static HTML document, it was generated by some server-side
processing (such as ASP, JSP, or PHP) or if there are 1,000,000 monkeys
tapping away at keyboards on the server. The client just sees "text/html"
and renders it. If that "text/html" contains client-side <script> tags (of
type "text/javascript"), then maybe that client-side script is executed,
maybe it isn't. But the client doesn't care _how_ the content was generated,
as far as the client is concerned it's all just static HTML pages.

Now for "what happens on the server". The server receives a request for
content and serves it to the client. It may do this by reading and sending a
static HTML page, it may do this by executing Perl, or reading and
interpreting PHP or ASP. It may do this by loading a servlet and running it
inside a Java Virtual Machine or it might shock 1,000,000 monkeys with
electricity to make them start typing. _It does not matter_. The end result
is a document of type "text/html" sent to the client. This document may or
may not contain content of type "text/javascript" between <script></script>
tags. _The server does not care_, it just sends it to the client.

HTTP is not an interaction which is typically called a client/server
application, where a client and server keep a connection between each other
open and can communicate bi-directionally anytime they wish. HTTP is a
"stateless" transaction, and in it's simplest form, data can only travel in
one direction at a time. The client makes a request, the server receives the
request and responds to the request. After that transaction takes place,
neither the client nor the server know or care if the other is still there.
In fact, the server doesn't even care if the client ever receives or
understands the data sent to it.

--
| Grant Wagner <gw*****@agricoreunited.com>

* Client-side Javascript and Netscape 4 DOM Reference available at:
*
http://devedge.netscape.com/library/...ce/frames.html

* Internet Explorer DOM Reference available at:
*
http://msdn.microsoft.com/workshop/a...ence_entry.asp

* Netscape 6/7 DOM Reference available at:
* http://www.mozilla.org/docs/dom/domref/
* Tips for upgrading JavaScript for Netscape 7 / Mozilla
* http://www.mozilla.org/docs/web-deve...upgrade_2.html
Jul 23 '05 #4

This discussion thread is closed

Replies have been disabled for this discussion.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.