I have an API returning a JSON object containing user settings. Before using it, I was used to filling fields with php:
<input type="checkbox" <?php echo $checked ?>>
Now I have a JSON object and no PHP output. How to manipulate it to do the same?
I thought about using jquery to fill in elements on document.ready:
$(document).ready(function() {
$('input').attr('checked', jsonobj.checked);
}
But something tells me that it's a bit hackish, is that the right way to do it?