I've got a html page with 2 checkboxradios. There's a button which should remove all radio buttons and load new ones through ajax.
I've got everything working, but there's a small problem with the css. This is what my radio buttons look like when opening the page:
This is what it looks like, after I removed the radios and loaded new ones through AJAX:
My HTML looks like this:
<div data-role="fieldcontain">
<fieldset data-role="controlgroup" id="campaignselection">
<input type="radio" name="campaign" id="autosalon_genf_2015" value="autosalon_genf_2015" checked="checked">
<label for="autosalon_genf_2015">Autosalon Genf</label>
<input type="radio" name="campaign" id="auto_zuerich_2014" value="auto_zuerich_2014">
<label for="auto_zuerich_2014">Auto Zürich</label>
</fieldset>
And this is the jQuery part that does the update:
$("#updatevalues").click(function() {
// Download campaign codes
$.ajax({
type: "GET",
dataType: "json",
url: 'http://hostname.com/api/directory',
success: function(response) {
// Remove all campaign entries from the current list
$("#campaignselection").empty();
$.each(response, function() {
$("#campaignselection").append('<input type="radio" name="campaign" id="' + this.code + '" value="' + this.code + '" />');
$("#campaignselection").append('<label for="' + this.code + '">' + this.label_de + '</label>');
$("#" + this.code).checkboxradio();
$("#" + this.code).checkboxradio("refresh");
});
//$("#campaignselection").trigger("create");
//$("input[type='radio']").checkboxradio();
//$("input[type='radio']").checkboxradio("refresh");
}
});
})
Is there another method I have to execute? The version of jQuery mobile is 1.4.2.