title: Sending multiple data parameters with jQuery AJAX
body: <p>I am sending an ajax request to a php file as shown here:</p>
  
  <pre><code>function checkDB(code, userid)
  {
  
    $.ajax({
    type: "POST",
    url: "&lt;?php bloginfo('template_url'); ?&gt;/profile/check_code.php",
    data: 'code='+code+'userid='+userid,
    datatype: "html",
    success: function(result){
  
         if(result == 0)
          {
              $('#success').html( code + ' has been redeemed!');
              // alert('success');//testing purposes
          }
          else if(result == 2)
          {
              $('#err').html(  code + ' already exists and has already been redeemed....');
              //alert('fail');//testing purposes
          }else if(result == 1){
              $('#err').html(  code + ' redeem code doesnt exist');      
          }
  
          alert(result);      
        }
    })
  
  }
  </code></pre>
  
  <p>This is sent calling the function on submit, like so:</p>
  
  <pre><code>&lt;form method="post" class="sc_ajaxxx" id="sc_add_voucherx" name="sc_ajax"  
       onsubmit="checkDB(document.sc_ajax.sc_voucher_code.value, &lt;?php echo $user_id ?&gt;); return false;"&gt;
  &lt;/form&gt;
  </code></pre>
  
  <p>The problem is that the user id php variable is not getting sent to the check_code.php page by ajax. or at least I cant seem to echo the id back to the page. </p>
  
  <p>Is this the correct way of passing multiple values to a server-side page? Without the userid passing over, it works fine just passing over the code.</p>
  
  <p>Thanks guys :)</p>