There are several checkboxes, you need to change their state depending on the state of the radiobutton :

 <label><input value="0" id="time_0" type="checkbox">0</label> <label><input value="1" id="time_1" type="checkbox">1</label> <label><input value="2" id="time_2" type="checkbox">2</label> <label><input value="3" id="time_3" type="checkbox">3</label> <input id="day" value="Пн" checked="" name="day" type="radio">Пн <input id="day" value="Вт" name="day" type="radio">Вт <input id="day" value="Ср" name="day" type="radio">Ср 

An array of checkbox states is taken from the database.

Handler:

 $('input[name=day]').change(function() { $.ajax({ dataType: "json", type: "POST", url: "time.php", data: { get: "", user: $('#user').val(), day: $('input[name=day]:checked').val(), } success: function(html){ alert(html); } }); }); 

In the file time.php displays json array. But when you click on the radiobutton nothing happens.

  • Add a handler that will send the state of the radio to the server, and get the current state of the checkboxes from the database. What is your problem? what have you tried and what have you failed to do? - Moonvvell

1 answer 1

You are missing a comma "}," before success

 $('input[name=day]').change(function() { $.ajax({ dataType: "json", type: "POST", url: "time.php", data: { get: "", user: $('#user').val(), day: $('input[name=day]:checked').val(), }, success: function(html){ alert(html); } }); });