Question

i have a jquery button Open/Closed

$(document).ready( function(){
    $(".cb-enable").click(function(){
        var parent = $(this).parents('.switch');
        $('.cb-disable',parent).removeClass('selected');
        $(this).addClass('selected');
        $('.checkbox',parent).attr('checked', true);
    });
    $(".cb-disable").click(function(){
        var parent = $(this).parents('.switch');
        $('.cb-enable',parent).removeClass('selected');
        $(this).addClass('selected');
        $('.checkbox',parent).attr('checked', false);
    });
});

Here all the code: http://jsfiddle.net/VMLmF/1/

And I need to do this operation:

  1. when is On: show in another page a Button open.
  2. when is off: show in another page a button closed.

Some one can give me some information about?

No correct solution

OTHER TIPS

You may use ajax and set a session variable for "On" and "Off" states. Add a condition in the other page to check the value of the session variable in such a way that :

if the session variable is set and is on, show the button "Open". Otherwise show the button "Closed".

You may set session variable in the following way:

$this->session->data['show_button'] = 'the on/off button value';

In the other page's controller file, add a condition like:

if (isset($this->request->post['show_button']) && $this->request->post['show_button']) 
{
 $this->data['show_button'] = true;
} 
else {
 $this->data['show_button'] = false;
}

Also don't forget to unset the session variable (unset($this->session->data['show_button']);) when its use is over.

Have a nice day !!

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top