What's wrong with this concatenation? [duplicate]

-1
$('#cidades').load('cidades.php?estado='+$('#estados').val()+'&cliente='+idcl);
                $('#transacao').load('transacao.php?estado='+$('#estados').val()+'&cliente='+idcl+'&teste='+$('#cidades'));

In the line above in bold I can not put in the variable teste the value of the #cidades parameter that is received on the top line. How do I resolve this situation, since I need the #cidade parameter to be taken in GET by the variable teste

    
asked by anonymous 09.12.2015 / 17:06

1 answer

4

With $ ('# cities') you are not taking any value. You are getting an Object.

If #cidades is an input, use

$('#cidades').val()

Note that you have correctly done with $ ('# States') using .val (), but if $ ('# cities') is not an input you will not be able to get the value you want.     

09.12.2015 / 17:08