Pass variable Javascript POST does not work

Asked

Viewed 30 times

0

I’m not getting past the value of <input name="i_content"> for javascript.

I’m doing like this:

<form url="deletar_convidado.php" method="post" id="reg-form_3<?php echo $i_content ?>" autocomplete="off" style="border:none;  float:left; width:50px">           
  <input type="hidden" name="i_content" id="i_content" value="<?php echo $i_content ?>">
  <input type="hidden" name="auxiliar_evento_usuarioss" id="auxiliar_evento_usuarioss" value="<?php echo $produto["auxiliar_evento_usuario"] ?>">
   <input type="hidden" name="deletar_convidado" id="deletar_convidado" value="<?php echo $row_convidado['id']; ?>">
    <button class="btn btn-info lista_convidado_1" type="submit"><i class="entypo-cancel-circled"></i></button> 
</form> 




$(document).on('click', '#reg-form_3'+$("#i_content").val(), function(e){

        e.preventDefault(); 

        $.ajax({
            url: 'deletar_convidado.php',
            type: 'POST',
            data: $(this).serialize() 
        })
        .done(function(data){
            $('#form-content_2'+$("#i_content").val()).fadeOut('slow', function(){
                $('#form-content_2'+$("#i_content").val()).fadeIn('slow').html(data);
            });
        })
        .fail(function(){
            alert('Ajax Submit Failed deletar convidado...');    
        });
     });

Where is the error?

  • It is not very clear your code. Why send only one entry in the POST instead of the form whole?

  • There are several inputs inside the form, so I used the form, I just need to know how to recover the value of input name=i_content for javascript, the way I did only the first record of the loop works, the others do not

No answers

Browser other questions tagged

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