Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to Call CGI from Javascript

Status
Not open for further replies.

rstambach

Technical User
Feb 7, 2011
3
US
I've got a hardware device that's controlled by a cgi server and if I use the following html it will turn on a cooling fan.

<div id="layer3" style="position:absolute; top:338; left:34; z-index:9;" ><A href=/rc.cgi?o=1,1 target="empty"><img id="FanPic" onclick = "ChangeFanState();" src="Fan&LIO(1,"%u",1);.gif" border=0 height="72" width="72"/></div>

I'd like to be able to do this from javascript so as to turn on several devices with out changing the web page. So I've tried

window.location.href = "/rc.cgi?o=1,1";

but this is not working.
Any ideas?Thanks
 
I think I got this to work by adding
I also use DHTML tag
&LIO(1,"%u",1)
to read the relay to see if its on or off and I need to set its value as a variable in my javascript but I can't seem to get anything to work.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top