javascript - jQuery $.getJSON() not sending value -
this question has answer here:
- can mix mysql apis in php? 5 answers
the first file is: form.php
.
i can't send values (1 or 2) other file.
can me out?
$(function () { $('#cod_cidades').change(function () { if ($(this).val()) { $('#s').hide(); var valor = ($(this).val()); $('.carregando').show(); $.getjson('vara.ajax.php', { cod_cidades: $(this).val(), ajax: 'true' }, function (j) { var options = '<option value=""></option>'; (var = 0; < j.length; i++) { options += '<option value="' + j[i].s + '">' + j[i].nome + '</option>'; } $('#s').html(options).show(); $('.carregando').hide(); }); } else { $('#s').html('<option value="">– escolha um estado –</option>'); } }); });
varas.ajax.php
this part value.
$id_cidade = mysql_real_escape_string( $_request['cod_cidades'] );
this (and had feeling that's problem was) "spidey sense tingling".
mysql_real_escape_string( $_request['cod_cidades'] )
and mentioned in comments using mysqli_
connect with, after asking it.
that mysql function not mix mysqli_
.
you need use mysqli_
equivalent:
mysqli_real_escape_string($connection, $_request['cod_cidades'] )
you need change $connection
variable match 1 using.
Comments
Post a Comment