l986
May 2, 2010, 6:21pm
1
I have made a web control server using Ethernet Sheild and the very good Google Code Archive - Long-term storage for Google Code Project Hosting. webduino . IT works fine ive got form buttons that will turn outputs on and off such as an led ect.
When i press a html button in the webpage it does a form submit and the page reloads on every button press.
Is there a method of controlling a output without having to reload the webpage after every button press ?
like if you want to control a servo motor you wouldnt want to wait for the page to refresh everytime .
any ideas ?
Any help would be great.
Thanks
Luke
bld
May 2, 2010, 6:26pm
2
Instead of load the entire page again, just open the link into the iframe.
l986
May 2, 2010, 6:39pm
3
Hey bld
thanks for your quick reply .
...thats a very good plan !
im not the best with html
This is how i do now ..
ON
OFF
so how would i do that in a i frame ?
cheers
luke
How about using javascript to do an ajax post?
Here is more information on that:
http://www.w3schools.com/ajax/default.asp
in the sample on :
http://www.w3schools.com/ajax/tryit.asp?filename=tryajax_first
you could replace this line:
xmlhttp.open("GET","ajax_info.txt",true);
with something like:
xmlhttp.open("GET","/servocontrol.htm?servo=1&position=15",true);
The sample from the site works with a button press, but you can assign it to fire when a textbox changes, or a slider moves, or mouse moves on the page, if you want.
There still will be some latency, but less than a full page reload.
l986
May 3, 2010, 7:04pm
5
OK just to say i done it using a iframe , it works fine.
Thanks for the help.
for anyone whos intrested this how you submit into an i frame.
ON
OFF
Tip... use the www.w3schools.com try it editor to test html code , makes life easier !
Thanks also spinlock ! , i will have a look into an ajax method when i got time but for the moment using a iframe was a simple fix .
cheers
Luke