I have a function named update that takes some options and post to my php using $.post:
function update(options){
$.post('update.php',{update: options}, function(data, textStatus, jqXHR){
// debug stuff from php
});
}
I call my function as follows:
update({'id': id, 'option': val});
What I would like to know is how I can make a conditional inside the options? For example:
var option = $(this).attr('class') == 'check' ? 'check' : 'ok'; // assuming option is ok
update({'id': id, 'ok': val}); // instead of option
update({'id': id, option: val}); // i want to have the conditional