I'm creating a filter using select elements. This is for a wheel store, so the values would be bolt patterns, sizes, colors, etc.
I have to make an AJAX call with all the selected values in the format:
value1+value2+value3....
The only way I could think of to do this would be to iterate over the selected options and add to the sign + and the selected value to the string and in the end use substring to remove the first + sign.
var SelectedFilters = '';
$('#CategoryFilter .BlockContent select').each(function(index, element) {
value = $(element).find('option:selected').val();
if(value != "Choose One"){
SelectedFilters += ('+' + value); // This is the line with the problem
});
SelectedFilters = SelectedFilters.substring(1,SelectedFilters.length);
The problem I'm having is with line 5 above. I'm getting a Syntax, unexpected token error, but I cannot figure out what is wrong with my syntax.