Toggles via AJAX
All you need for this is a
$.ajax() call and the data-value content added to the span element.
Note how this is even tab safe as we are passing the "new" value along instead of just sending the "invert" command. If another tab already set it to active, it will stay this value instead of reverting it again.
A simple AJAX toggle. Press F5 after you changed it to verify that the "simulated DB save" worked.