Can I get some ideas or an example of how I could fill in the checked state of the switches associated with the data being loaded from the database?
For example, I generate an array from a query SELECTthat looks like this:
array(
[0] => array(
['note_id'] => 1
['value'] => 'no'
)
[1] => array(
['note_id'] => 4
['value'] => 'yes'
)
[2] => array(
['note_id'] => 5
['value'] => 'yes'
)
)
Groups of flags look like this:
<input type="radio" name="1" value="yes">
<input type="radio" name="1" value="no">
<input type="radio" name="1" value="done">
<input type="radio" name="2" value="yes">
<input type="radio" name="2" value="no">
<input type="radio" name="2" value="done">
Now, using json_encode, I put an array of results data in:
[{"note_id":"1","value":"no"},{"note_id":"4","value":"yes"},{"note_id":"5","value":"yes"}]
I pass these results back through ajax .. something like?
$j.ajax({
url: readurl,
type: "GET",
data: 'sku=' + thisSku,
dataType: "json",
success: function (data){
}
});
- , json, ? , , note_id [name], , ? json ? .getJSON()?