I have some form with several values depending which is selected
<form action="#">
    <select id="tropa1" name="tropa1">
        <option value="rec_b_unit">Case1</option>
        ....
        <option value="rec_z_unit">Case20</option>
    </select>
    <input id="go" type="button">
</form>
Now script
$(document).ready(function() {
    $("#go").click(function() {
        // Obtener la referencia a las listas
        var lista1 = eval(document.getElementById("tropa1"));
        // Obtener el valor de la opción seleccionada
        var valort1 = eval(lista1.options[lista1.selectedIndex].value);
        var cadena = String(valort1);
        console.log("PHP: " + String(valort1));
        if (cadena.indexOf('z') != -1) {
            // value selected in options does not contain 'z'
            console.log("DOES NOT CONTAIN Z");
            console.log(cadena);
            confront(nu1, valort1, nu2, valort2)
        } else {
            //// value selected in options contains 'z'
            console.log("CONTAINS Z");
            console.log(cadena);
        }
    })
});
I tried to make this, but console return : [object Object] and not show string. even using String() function or eval() to convert object to a string
 
    