title: pass arrays and variables from jquery to php at the same time
body: <p>I want to pass arrays and other variables from jquery code to php using post request but I don't know how to pass arrays and variables at the same time.</p>
  
  <p><strong>I tried this code:</strong></p>
  
  <pre><code>var new_location_name = "";
  var new_location_id = "";
  var old_location_name = [];
  var selected_name = [];
  var selected_id = [];
  var user = '&lt;?php echo $current_user ;?&gt;';
  
      $(document).ready(
             $("#transfer").click(function(){
                   $.ajax({
                      type: "POST",
                      url: "update.php",
                      data: "username="+user+"&amp;new_location_name="+new_location_name+"&amp;new_location_id"+new_location_id+"&amp;"+{ old_location_name : old_location_name }+"&amp;"+{ selected_name : selected_name }+"&amp;"+{ selected_id : selected_id },
                  });
                   return false;
              });
      });
  </code></pre>