Parameters with Ajax

0

Hello, I'm trying to pass parameters with information variables from two Dropdown fields, but I'm not able to use two variables when I use only one with it normally. follows an example:

$(function(){
$('#alerta_cor').hide();
$('#id_cod_item').change(function(){
if( $(this).val() ) {
$('#cor_prod').hide();
$('#alerta_cor').show();
$.getJSON('select_cor_prod.php?search=',{id_cod_item: $(this).val(), ajax: 'true'}, function(j){
var options = '<option value="">Escolha a Cor</option>';
for (var i = 0; i < j.length; i++) {
options += '<option value="' + j[i].id_cor + '">' + j[i].desc_cor + '</option>';
}
$('#id_cor_prod').html(options).show();
$('#alerta_cor').hide();
});
} else {
$('#id_cor_prod').html('<option value="">– Escolha o produto –</option>');
}
});

The problem is when I try to pass two variables does not present the information, ie it does not work, I do not have much skill with ajax, so I think I'm doing something wrong in the declaration of variables. Here is the line I changed to load two variables, which are id_cod_item and prod_location.

$.getJSON('select_cor_prod.php?search=',{id_cod_item: $(this).val(), situacao_prod: $(this).val(), ajax: 'true'}, function(j){

If someone can guide what I'm doing wrong thank you.

att Ebert

    
asked by anonymous 26.06.2018 / 03:56

0 answers