By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
437,605 Members | 2,128 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 437,605 IT Pros & Developers. It's quick & easy.

Can Javascript access request object? Need to persist data

P: n/a
How can I access the request and response object for a page using
javascript. I want to stick some data on with something like
request.setAttribute( "User's choice for later use" ).
I can't seem to find a reference to request or response objects in
JavaScript either in Google Groups or O'Reilly's "JavaScript the Definitive
Guide" (surely it should be in the latter, huh?)

I know I could use a hidden form element but the data would be a Parameter
and not stay around long enough; the user may recall the data much later in
the session. I'd rather not have to gather the parameter and reattach it as
an Attribute on the server everytime a page is submitted with data that need
to persist over the invocation of many unpredictable pages.

Thanks for your suggestions.

jim

p.s. I'm avoiding cookies so things will still work if cookies are
disabled.


Sep 17 '05 #1
Share this Question
Share on Google+
3 Replies


P: n/a
There's no "request" or "response" object that I know of client-side.
These are pretty much server-side constructs.

Maybe you would be better off taking some time to describe exactly
what your environment is and what you need to do. It seems like you
need to persist some info across multiple pages, so a server-side
session parameter sounds like a good bet (particularly if you want to
be cookie-independent).

Tim.


"news.rcn.com" <ca******@hotmail.com> wrote in message
news:5_********************@rcn.net...
How can I access the request and response object for a page using
javascript. I want to stick some data on with something like
request.setAttribute( "User's choice for later use" ).
I can't seem to find a reference to request or response objects in
JavaScript either in Google Groups or O'Reilly's "JavaScript the
Definitive Guide" (surely it should be in the latter, huh?)

I know I could use a hidden form element but the data would be a
Parameter and not stay around long enough; the user may recall the
data much later in the session. I'd rather not have to gather the
parameter and reattach it as an Attribute on the server everytime a
page is submitted with data that need to persist over the invocation
of many unpredictable pages.

Thanks for your suggestions.

jim

p.s. I'm avoiding cookies so things will still work if cookies are
disabled.

Sep 18 '05 #2

P: n/a
Yes, persisting info across multiple pages is exactly what I want to do and
a session parameter would do the trick excellently well. The issue is how to
get the info on the session parameter.

Ideally, in my opinion, the client-side page where the info in solicited
from the user should do the persisting; this way no one else need be
involved.

If this can't be done, then, on the server side, I'd have to examine each
request for a new page to see if some user-inputted info is attached and
then deal with it. Or perhaps have the client request be forwarded to a
special page (actually servlet) which would persist the info then forward to
the page that the client 'really' wants next.

All in all, more complicated then having the guy that wants to save
something save it and be done with it. Sounds like cookies may be the easy
way and then deal with users with cookies blocked when the issue comes up.

Thanks for your help.
"Tim Williams" <sa************@THISpacbell.net> wrote in message
news:b7****************@newssvr12.news.prodigy.com ...
There's no "request" or "response" object that I know of client-side.
These are pretty much server-side constructs.

Maybe you would be better off taking some time to describe exactly what
your environment is and what you need to do. It seems like you need to
persist some info across multiple pages, so a server-side session
parameter sounds like a good bet (particularly if you want to be
cookie-independent).

Tim.


"news.rcn.com" <ca******@hotmail.com> wrote in message
news:5_********************@rcn.net...
How can I access the request and response object for a page using
javascript. I want to stick some data on with something like
request.setAttribute( "User's choice for later use" ).
I can't seem to find a reference to request or response objects in
JavaScript either in Google Groups or O'Reilly's "JavaScript the
Definitive Guide" (surely it should be in the latter, huh?)

I know I could use a hidden form element but the data would be a
Parameter and not stay around long enough; the user may recall the data
much later in the session. I'd rather not have to gather the parameter
and reattach it as an Attribute on the server everytime a page is
submitted with data that need to persist over the invocation of many
unpredictable pages.

Thanks for your suggestions.

jim

p.s. I'm avoiding cookies so things will still work if cookies are
disabled.


Sep 22 '05 #3

P: n/a

news.rcn.com wrote:
How can I access the request and response object for a page using
javascript. I want to stick some data on with something like
request.setAttribute( "User's choice for later use" ).
I can't seem to find a reference to request or response objects in
JavaScript either in Google Groups or O'Reilly's "JavaScript the Definitive
Guide" (surely it should be in the latter, huh?)

I know I could use a hidden form element but the data would be a Parameter
and not stay around long enough; the user may recall the data much later in
the session. I'd rather not have to gather the parameter and reattach it as
an Attribute on the server everytime a page is submitted with data that need
to persist over the invocation of many unpredictable pages.

Thanks for your suggestions.

jim

p.s. I'm avoiding cookies so things will still work if cookies are
disabled.


There is no Request object in javascript per se, but you can do some
things that the Request object does. For example, a Request object in
ASP can be used to manipulate cookies, read the QueryString, and gather
form data.

You can do all three of these with javascript. Since you're wanting to
pass information around to each page without using cookies, you could
probably use a mixture of hidden forms and the querystring. However
with the QueryString, you can only pass around GET data, as client-side
javascript cannot gather POST data for obvious reasons.

Sep 22 '05 #4

This discussion thread is closed

Replies have been disabled for this discussion.