FAQ Topic - How do I run a server side script?

F

FAQ server

-----------------------------------------------------------------------
FAQ Topic - How do I run a server side script?
-----------------------------------------------------------------------

You trigger a server-side script by setting any object's URL. For
example a frame, window, or an Image. An image will also
"swallow" the data sent back by the server, so that they will
not be visible anywhere.

var dummyImage = new Image();dummyImage.src = "scriptURL.asp?param=" + varName;

Mozilla (NN6.2+, Firefox, Ice Weasle etc), Opera 7.6+, Safari1.2+, the
Windows version of IE versions 5+, and some other browsers
provide the XML HTTP Request object. This allows JavaScript to
send HTTP requests directly to the server, and interact with
the responses returned.

http://jibbering.com/2002/4/httprequest.html


===
Postings such as this are automatically sent once a day. Their
goal is to answer repeated questions, and to offer the content to
the community for continuous evaluation/improvement. The complete
comp.lang.javascript FAQ is at http://jibbering.com/faq/index.html.
The FAQ workers are a group of volunteers.
 
D

Dr J R Stockton

In comp.lang.javascript message <[email protected].

Any object? a Date Object? new Boolean(7)? I did not know that.
For
example a frame, window, or an Image.

If "any object" then examples should not be needed. If only some
objects, then examples are an insufficient indication.
An image will also
"swallow" the data sent back by the server, so that they will
not be visible anywhere.

An image? I think it means an image Object.
var dummyImage = new Image();dummyImage.src = "scriptURL.asp?param=" +
varName;

That's not setting its URL; that's setting its src property to a string
holding an URL.

If that's sufficient code, then ISTM that it may clutter the name-space
with a superfluous name; would
new Image().src = "scriptURL.asp?param=" + varName;
suffice ?


Either that page should have a link (or a more obvious link) to
reference material (answering, for example, "what sorts of HTTP request
can you use?"), or the FAQ entry should.
 
D

Dr J R Stockton

In comp.lang.javascript message said:
Dr J R Stockton said the following on 5/13/2007 4:59 PM:

Did you test it? I think you already knew the answer before posting or
you wouldn't be posting with such an obtuse attitude.

Subtlety is wasted on Merkins. But the effect is amusing.
Does a Date Object have a native URL/SRC attribute?

The quoted words say "any object".
Does a Boolean Object have a native URL/SRC attribute?
Ditto.


Only for you. Nobody else has ever had a problem with the entry.

Can you prove that?
No, an image itself can be made to swallow data:

<img src="someServerScript.php" width="1" height="1">

Where is the "Image Object"?

That's new code, not in the current FAQ. Therefore, it is inaccessible
to the reader of the current FAQ.

Anyway, an image is a picture. It will be the structure that holds the
image data that ignores the returned data.
Pedantically Semantically true.

The FAQ should say what it means; anything else leads to doubt and
misunderstanding, at best.
If you are only going to use it once then it does.


Yes, it would suffice. But, if you are going to use it more than once,
the above code needlessly creates multiple image Objects.

IMHO, it's not the sort of thing that will be executed vary many times
in quick succession, so the garbage collector can be allowed to deal
with them.
That page *is* for reference material. And the FAQ does have links to
reference material.

Not in section 4.34. The only mentions in the FAQ of capital HTTP are
in 4.34 and 4.38. XML is undefined in the FAQ, but a search for it does
find a link to http://developer.mozilla.org/en/docs/XMLHttpRequest.
That, or whichever links you mean, needs to be (also) in 4.34.

But that's Jim's page; if he so chooses, Jim'll fix it. That's a vile
UK allusion.
 
D

Dr J R Stockton

In comp.lang.javascript message said:
Dr J R Stockton said the following on 5/14/2007 3:03 PM:

Based on the lack of comment on it? The only person I am aware of that
has complained about this entry, since I took over the FAQ, is you. Can
you prove otherwise?

That's not the point. You made an assertion, and I asked whether you
could prove it right. That's quite another matter from whether I, or
anyone else, can prove it wrong.
 
L

-Lost

ashore said:
Awww, ladies, ladies. C'mon! Back to JavaScript, please?

What are you talking about?
Who are you talking to?

Please, quote what you are replying to.
 

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,744
Messages
2,569,482
Members
44,901
Latest member
Noble71S45

Latest Threads

Top