Login or Sign up Help | Site Map
Connecting Tech Pros Worldwide

Need help with posting to CGI from javascript

Question posted by: Stacey (Guest) on July 20th, 2005 03:11 PM
Here is a function that is declared in my html page. It is part of a series
of javascript that allows the user to draw a rectangle on a graphic. This
is called when the box is done, so I would like to send the screen coords
which I know already to a cgi script at this point below. Can anybody help
me?

Somebody mentioned this code, but I am not sure how exactly to go about and
where to put code etc etc. It uses the urlconnection. Not sure of syntax.
Thanks again.
http://www.javaworld.com/javaworld/...-javatip34.html



function dragDone(x,y) {
startlayer.moveTo(iX,iY)
alert("Box is done")

need to post to cgi here

}



Would you like to answer this question?
Sign up for a free account, or Login (if you're already a member).
Miguel De Anda's Avatar
Miguel De Anda
Guest
n/a Posts
July 20th, 2005
03:11 PM
#2

Re: Need help with posting to CGI from javascript

"Stacey" <stacye@optonline.net> wrote in message
news:uiJPa.21724$hY1.6513370@news4.srv.hcvlny.cv.n et...[color=blue]
> Here is a function that is declared in my html page. It is part of a[/color]
series[color=blue]
> of javascript that allows the user to draw a rectangle on a graphic. This
> is called when the box is done, so I would like to send the screen coords
> which I know already to a cgi script at this point below. Can anybody[/color]
help[color=blue]
> me?
>
> Somebody mentioned this code, but I am not sure how exactly to go about[/color]
and[color=blue]
> where to put code etc etc. It uses the urlconnection. Not sure of[/color]
syntax.[color=blue]
> Thanks again.
> http://www.javaworld.com/javaworld/...-javatip34.html
>
>
>
> function dragDone(x,y) {
> startlayer.moveTo(iX,iY)
> alert("Box is done")
>
> need to post to cgi here
>
> }
>
>
>[/color]

function dragDone(x,y) {
startlayer.moveTo(iX,iY);
alert("Box is done");

if ("java"=="javscript") {
alert("Ask question in comp.lang.java.help");
} else {
alert("Ask question in comp.lang.javascript");
}
}








But if you really want to know, this is what I like to do:

I create a hidden frame, be it an iframe or from a frameset. Have a form in
there that will receive data from the dragDone(x,y) function. Submit the
form to you cgi. This will prevent the main window from submiting the data
(and prevent the user from doing more things). From what I'm guessing, you
may need some way to buffer the input and send larger packets of input
together.



Ron Savage's Avatar
Ron Savage
Guest
n/a Posts
July 20th, 2005
03:12 PM
#3

Re: Need help with posting to CGI from javascript
"Stacey" <stacye@optonline.net> wrote in message
news:uiJPa.21724$hY1.6513370@news4.srv.hcvlny.cv.n et...[color=blue]
> Here is a function that is declared in my html page. It is part of a[/color]
series[color=blue]
> of javascript that allows the user to draw a rectangle on a graphic. This
> is called when the box is done, so I would like to send the screen coords
> which I know already to a cgi script at this point below. Can anybody[/color]
help


# 30:

http://savage.net.au/Perl-tuts-1-30.html

--
Ron Savage
Join Bytes!
http://savage.net.au/index.html



 
Not the answer you were looking for? Post your question . . .
173,563 Experts ready to help you find a solution.
Sign up for a free account, or Login (if you're already a member).

  • Didn't find the answer you were looking for?
    Post Your Question
  • Top Community Contributors