What’s wrong with this concatenation?

Asked

Viewed 56 times

-1

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

On the line above in bold I cannot put in variable teste the value of the parameter #cidades which is received on the top line. How to resolve this situation as I need the parameter #cidade is taken in GET by the variable teste

  • Hello Gladison, I noticed you had several questions closed recently. I recommend that to increase your chances of getting a good answer make a [tour] and read the guide [Ask].

1 answer

4


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

If #cities is an input, use

$('#cidades').val()

Note that you did it correctly with $('#States'), using . val(), but if $("#cities") is not an input you won’t be able to get the value you want.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.