Connecting Tech Pros Worldwide Forums | Help | Site Map

POST to standard HTML and parse parameters in Javascript

Jay
Guest
 
Posts: n/a
#1: Mar 23 '06
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


Martin Honnen
Guest
 
Posts: n/a
#2: Mar 23 '06

re: POST to standard HTML and parse parameters in Javascript




Jay wrote:
[color=blue]
> 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?[/color]

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).

--

Martin Honnen
http://JavaScript.FAQTs.com/
Thomas 'PointedEars' Lahn
Guest
 
Posts: n/a
#3: Mar 23 '06

re: POST to standard HTML and parse parameters in Javascript


Jay wrote:
[color=blue]
> Does anyone know if you can do an HTML POST to a plain html file using[/color]

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

.... 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
Jay
Guest
 
Posts: n/a
#4: Mar 23 '06

re: POST to standard HTML and parse parameters in Javascript


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!!

Thomas 'PointedEars' Lahn
Guest
 
Posts: n/a
#5: Mar 23 '06

re: POST to standard HTML and parse parameters in Javascript


Jay wrote:
[color=blue]
> Yeah,[/color]

Are you referring to something? See below.
[color=blue]
> 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.[/color]

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

Yes, it would.
[color=blue]
> 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.[/color]

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.
[color=blue]
> Thanks for the help!![/color]

You are welcome.


PointedEars
Jay
Guest
 
Posts: n/a
#6: Mar 23 '06

re: POST to standard HTML and parse parameters in Javascript


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
[color=blue]
> 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.
>[color=green]
> > Thanks for the help!![/color]
>
> You are welcome.
>
>
> PointedEars[/color]

Closed Thread


Similar JavaScript / Ajax / DHTML bytes