Need Help to submit form with jquery & ajax

Need Help to submit form with jquery & ajax

Hello im trying to submit a form by ajax but i have a problem i generate 1 form with same class with php for each product i have in my DBase so all have the same class and jquery submit is working fine but only submit the 1st form this is my function:

  1. $(document).ready(function(){ 
    $(".formulario").submit(function() { 
       // we want to store the values from the form input box, then send via ajax below 
         var idc     = $('.idc').attr('value');
         var idp     = $('.idp').attr('value');
         var adiciona = $('.adiciona').attr('value');
         alert("idc="+idc);
         alert("idp="+idp);
         alert("qunt"+adiciona);
        $.ajax({ 
         type: "POST", 
         url: "carrinho.php", 
         data: "idp="+ idp +"& idc="+ idc +"& adiciona=" + adiciona, 
         success: function(){ 
         $('form#submit').hide(function(){$('div.success').fadeIn();}); 
           } 
            }); 
        return false;  
    }); });



















this only submit 1st form i need to do something like get values of form with "this" by paremeter. Anybody can help me?