On Sun, Apr 8, 2012 at 3:25 PM, nexx <[email protected]> wrote:

> First, thanks for iui developers for providing this nice webkit!
>
> I can't figure out how to read/set an on/off switch using php. What
> I'd like to do is simply generate a code that:
> - illustrate in a on/off button the status of a device (example: reads
> the device' state from a php variable like $device_status=1  (1=on,
> 0=off)
>

<div class="toggle" onclick="" <?php if($device_status==1) {
echo toggled="true" } ?>>
  <span class="thumb"></span><span class="toggleOn">ON</span>
  <span class="toggleOff">OFF</span>
</div>


> - if user tap the on/off button while it is off, it should call a URL
> (ex: http://localhost/turn_on_device.php) to turn it on (and vice-
> versa)
>

You need to add an Ajax call to the onclick event.


>
> Would someone please post a code snippet illustrating how to do that?
>
> thanks
> V
>
> --
> You received this message because you are subscribed to the Google Groups
> "iPhoneWebDev" group.
> To post to this group, send email to [email protected].
> To unsubscribe from this group, send email to
> [email protected].
> For more options, visit this group at
> http://groups.google.com/group/iphonewebdev?hl=en.
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"iPhoneWebDev" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/iphonewebdev?hl=en.

Reply via email to