POST newbie question

B

Bo Rasmussen

Hi

On this webpage of mine I have some buttons which when pressed should POST
an already known request - say http://mydomain/mypage.jsp?delete=yes. To
make a post like that do I have to make a form with a hidden INPUT named
"delete" containing "yes"? Or is there a simpler way to do it?

-Bo
 
B

Bo Rasmussen

I guess a Post method on some object where the parameters for the Post could
be set would be a bit simpler...
 
R

Richard Cornford

Bo said:
On this webpage of mine I have some buttons which when pressed
should POST an already known request - say
http://mydomain/mypage.jsp?delete=yes.

By "post" I assume you mean an HTTP post request to the server, it
contrast to the get request that will result form the URL described.
To make a post like that do I have to make a form
with a hidden INPUT named "delete" containing
"yes"?

Yes (but you will also need a submit button so the user can initiate the
action).
Or is there a simpler way to do it?

No, but there are more complex ways.

Richard.
 
B

Bo Rasmussen

Thanks

-Bo
Richard Cornford said:
By "post" I assume you mean an HTTP post request to the server, it
contrast to the get request that will result form the URL described.


Yes (but you will also need a submit button so the user can initiate the
action).


No, but there are more complex ways.

Richard.
 
R

Richard Cornford

Bo said:
I guess a Post method on some object where the
parameters for the Post could be set

There is an object that can do that; the XML HTTP Request object.
would be a bit simpler...

You have two implantation styles; the IE (ActiveX) way and the other
way. Support is currently limited to IE, Mozilla/Gecko, Safari and the
very latest (7.6) Opera, and in IE you are relying on ActiveX being
enabled in addition to scripting. To achieve reliability, and avoid a
needless javascript dependency you would design the implementation to
short-circuit the submission of an HTML form (so the form could be use
when the XML HTTP Request object was not available). And as the object
does background requests and should be used asynchronously on a browser
you would need to provide a call-back mechanism to handle the returned
response (and provide two types of response from the server depending on
whether the request was from the object or the HTML form).

That isn't really simpler compared with just having a server-side script
drop an HTML form into a page.
"Andrew Thompson" ...

Please do not top post to comp.lang.javascript.

Richard.
 

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

No members online now.

Forum statistics

Threads
473,774
Messages
2,569,598
Members
45,157
Latest member
MercedesE4
Top