Refresh Radio-Buttons

Refresh Radio-Buttons

Hi,
im new with jquery and have a problem with radio buttons:


  1. <input type="radio" name="radio-choice-h-2" id="radio-choice-h-2a" value="1">
  2. <label for="radio-choice-h-2a">Button1</label>

  3. <input type="radio" name="radio-choice-h-2" id="radio-choice-h-2b" value="2">
  4. <label for="radio-choice-h-2b">Button2</label>
  5.                                 
  6. <input type="radio" name="radio-choice-h-2" id="radio-choice-h-2c" value="3" >
  7. <label for="radio-choice-h-2c">Button3</label>

Im loading the informations, if a button is checked or not, from an arduino with ajax.
I want that a only one button ist automaticly chacked (and the other two unchecked) if the state changed.
so i tryed different options and now using an if-request:

if(...){
$('#radio-choice-h-2a').attr('checked',true).button('refresh')
$('#radio-choice-h-2b').attr('checked',false).button('refresh')
$('#radio-choice-h-2c').attr('checked',false).button('refresh')}
else if(...){
$('#radio-choice-h-2a').attr('checked',false).button('refresh')
$('#radio-choice-h-2b').attr('checked',true).button('refresh')
$('#radio-choice-h-2c').attr('checked',false).button('refresh')}
...

its a very unclear possibility, i know.. but im absolutly beginner in jquery and java.
but this option only works 1 time.. button1 is checked, after some time the state changes and button 2 is checked (button 1 unchecked) and a little time later button 1 checked again (button 2 is unchecked) but button 1 dont check. Same for button 2 and three.. Have anybody a clear solution for updating the checked/uncecked state of the buttons by an extern source?