I'm creating a script that first sends the code where the user gets a summary of the data, then he clicks a button to send the data to the webmaster's email.
I have this php data:
<?php
        $name = $_POST['name'];
        $email = $_POST['email'];
        ?>
Then I need ajax to get that data in a way it can read and submit to a php form:
<script type="text/javascript">
 $(document).ready(function() { //Quando documento estiver pronto
   $('#btnEnviarEmail').click(function() {
         var name = $('#name').val();
         var email = $('#email').val();
         var urlData = {
                     "name": name,
                     "email": email
                  };
         // Ajax 
         $.ajax({
             type: "POST",
             url: "sendmailivamdefinitivo.php", // endereço do phpmailer
             async: true,
             data: urlData,
             // informa Url
             success: function(data) { // sucesso 
                 $('#retornoHTML').html(data);
             },
             beforeSend: function() { // antes de enviar 
                 $('.loading').fadeIn('fast');
             },
             complete: function() { // completo 
                 $('.loading').fadeOut('fast');
             }
                });
           });
           });
     </script>
Should I use it this way to get the php strings?:
 var name = $('name').val();
 var email = $('email').val();
 
    