To simplify the question let's say I have a group of checkboxes (if selected - a specific style applied) and a href link.
<input type=checkbox style="color:#0f0; background:#0f0; border:1px solid;" name=CHKB_3D unchecked>
<span id=CHKB_3D_span style="">3D Model</span><br/>
<input type=checkbox name=CHKB_2D checked>
<span id=CHKB_2D_span style="color:#00D100;">2D Drawing</span><br/>
<input type=checkbox name=CHKB_ST checked>
<span id=CHKB_ST_span style="color:#00D100;">Stack up</span><br/>
<a onclick="ajax_json_styling()" href="javascript:void(0);">click me to change style!</a>

The values of the checkboxes status are stored in the database. The server (PHP) should decide which new color of checkbox label (span) I will have. If not selected -> while, if selected -> green.
I have a working version of this behavior: When I press href "save", I send ajax request to php, then on server side I write the new values of the status of the checkboxes. Then I create and echo a hidden DIV (later it's content will be eval() to apply new style) with specific styles that is based on current server data for checkboxes. Then in Ajax I eval() the content of that hidden DIV and in that way apply new styling based on server data for checkboxes.
The challenge is to migrate from eval() to JSON+JSON.parse(). I know how to update multiple DIVs content with JSON (in Ajax I hardcode which DIV with a specific ID to update). But my situation is a bit different, because I need to decide on the server side which element to update (based on DB records).
I don't need hardcoded code in JS or JQuery on which element to apply styling, but the choice of which element should be done grammatically based on server side.
Can I do that with JSON?
Please provide a logic or a simple example on how I can do that.
Thank you in advance for any help!