POST to standard HTML and parse parameters in Javascript

J

Jay

Hi,
Does anyone know if you can do an HTML POST to a plain html file using
javascript to receive and parse the parameters, instead of using asp,
php, or a plain-old cgi program?
Thanks,
Jay
 
M

Martin Honnen

Jay said:
Does anyone know if you can do an HTML POST to a plain html file using
javascript to receive and parse the parameters, instead of using asp,
php, or a plain-old cgi program?

You can use J(ava)Script on the server (e.g. in ASP) to process a HTTP
POST request. POSTing data to a plain HTML document should give an error
(usually HTTP 405 Method not allowed).
 
T

Thomas 'PointedEars' Lahn

Jay said:
Does anyone know if you can do an HTML POST to a plain html file using

There is no such thing as a "HTML POST". There is the _HTTP_ POST command
and (therefore) request type, ...
javascript to receive and parse the parameters, instead of using asp,
php, or a plain-old cgi program?

.... which is why that is not possible with _client-side_ scripting. "Using
ASP, PHP, or a plain-old CGI program" involves an HTTP server, which is why
it is possible there. You can use _Server-Side_ JavaScript[tm] of course,
but I think you had a client-only solution in mind. There can be none.


PointedEars
 
J

Jay

Yeah, I am integrating w/Google Maps and passing a large about of XML
to the webpage via a GET request. Unfortunately there is a limit in
the URL size of about 2083 kb I believe. I believe that using a POST
would allow me to send a larger amount of data. I don't want to stand
up a server or PHP since it is just a single page embedded in an
Internet Explorer ActiveX control. I guess I'll just use COM to invoke
a javascript method and pass the date that way. Thanks for the help!!
 
T

Thomas 'PointedEars' Lahn

Jay said:

Are you referring to something? See below.
I am integrating w/Google Maps and passing a large about of XML
to the webpage via a GET request. Unfortunately there is a limit in
the URL size of about 2083 kb I believe.

More like 2083 _bytes_ (here: characters), and AFAIK in Internet Explorer
only.
I believe that using a POST would allow me to send a larger amount of
data.

Yes, it would.
I don't want to stand up a server or PHP since it is just a single page
embedded in an Internet Explorer ActiveX control. I guess I'll just use
COM to invoke a javascript method and pass the date that way.

Not understood. The server you would be POSTing to would be the server
where Google Maps runs on, so you do not need a server of your own. /Iff/
the Google Maps server-side script can handle POST the same way it can
handle GET data, you can make a POST request, using a form[method="POST"],
or an XMLHTTP request object (which is an ActiveX/COM object in IE).
However, with the latter there are some security restrictions (Same Origin
Policy) that may apply here. If these restrictions apply, you will need a
server of your own, though, to facilitate server-side redirection.

Please use "Options, Reply" in Google Groups to quote the minimum you are
replying to next time.
Thanks for the help!!

You are welcome.


PointedEars
 
J

Jay

I have an html page that embeds a Google Map in a div layer. In order
to customize
what markers and map locations are being displayed I send XML to the
webpage and parse it using Javascript/MSXML2 object. Unfortunately
there is a limit to the size of XML I can pass using a GET request. So
inorder to send larger amounts of date to the webpage, I would have to
standup a server or cgi program that can handle the large request.
Since my app uses an embedded IE control I can query for the
IHTMLDocument COM interface and eventually call a javascript method
directly using
IDispatch.
Thansk,
Jay
Not understood. The server you would be POSTing to would be the server
where Google Maps runs on, so you do not need a server of your own. /Iff/
the Google Maps server-side script can handle POST the same way it can
handle GET data, you can make a POST request, using a form[method="POST"],
or an XMLHTTP request object (which is an ActiveX/COM object in IE).
However, with the latter there are some security restrictions (Same Origin
Policy) that may apply here. If these restrictions apply, you will need a
server of your own, though, to facilitate server-side redirection.

Please use "Options, Reply" in Google Groups to quote the minimum you are
replying to next time.
Thanks for the help!!

You are welcome.


PointedEars
 

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
474,431
Messages
2,571,677
Members
48,796
Latest member
Greg L.

Latest Threads

Top