why can't i have a variable in an object? I get an error like:
"Uncaught SyntaxError: Unexpected token this"
My code is like this.
$("#search_options input:checkbox").on('click', function() {
var params = {
$(this).attr('name') : $(this).val(),
};
var str = jQuery.param(params);
});
I'm sure that $(this) is working because I tried to console.log it outside the params object then i is working.