Problems jquery ajax

Asked

Viewed 71 times

0

I have a problem which is this:

in my system I have a combo that serves as parameter to load( via ajax) a second combo, this works normally.

Hence I need that when clicking an item in a table, the first combo is updated and based on the selected item of the combo it loads a second combo.

But it doesn’t work!

I’ve used / live / bind from jquery, but it doesn’t work

follows the code:

$('.tableLineCargo'). live(click', fillCargo); $('#responsavelcombo'). on('change', listAlvos);

    function listarAlvos(){
      var dados = {
        acao: 'combo',
        nome: alvo
      };

      var vurl;
      var respcombo = $('#responsavelcombo').val();

      if (respcombo == 0){
        $('#alvocombo').html("");
      }else{
        if (respcombo == 1){vurl = 'associacaocrud.php';}
        if (respcombo == 2){vurl = 'grupocrud.php';}
        if (respcombo == 3){vurl = 'regiaocrud.php';}
        if (respcombo == 4){vurl = 'templocrud.php';}

        $.ajax({
          url: vurl,
          type: 'POST',
          data: dados,
          success: function(retorno){
            $('#alvocombo').html(retorno);           
          }
        });
      }
    };  
  • I believe that for someone to help you, you will need the relevant information.

  • Hi Ney! Click on [Edit] and add the code you have so we can help more.

  • Post the html and php code you are using with this ajax, so we can help you better.

No answers

Browser other questions tagged

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