title: Passing Parameters To JQuery Ajax Call
body: <p>I am new to JQuery.  I've figured out how to make an AJAX call, and how to create callback functions for success or failure.  I am having difficulties figuring out how to pass parameters, though.  Here is my JQUery code:</p>
  <pre><code>$(document).ready(function(){
  $('#submit_new_admin').click(function() {
  
      
      $.ajax({
        type: 'POST',
        url: '[mu_url]/process_request.php',
        data: { request: 'add_new_admin' },
        beforeSend:function(){
          $('#ajax-panel').html('&lt;div class=&quot;loading&quot;&gt;&lt;img src=&quot;/images/loading.gif&quot; alt=&quot;Loading...&quot; /&gt;&lt;/div&gt;');
        },
        success:function(data){
        alert('ok')'
        },
        error:function(){
          $('#ajax_response').html('&lt;p class=&quot;error&quot;&gt;&lt;strong&gt;Oops!&lt;/strong&gt; Try that again in a few moments.&lt;/p&gt;');
        }
      });
  }); 
  });
  </code></pre>
  <p>That works well enough, but I want to set the parameter variables dynamically.  Here is a form that I am using:</p>
  <pre><code>    &lt;form name=&quot;&quot; action=&quot;&quot; method=&quot;post&quot;&gt;
          &lt;select name=&quot;user_level&quot;&gt;
              &lt;option value=&quot;1&quot;&gt;Full Admin&lt;/option&gt;
              &lt;option value=&quot;2&quot;&gt;Junior Admin&lt;/option&gt;
          &lt;/select&gt;&lt;br/&gt;&lt;br/&gt;
          &lt;label for=&quot;firstname&quot;&gt;Firstname&lt;/label&gt;  &lt;input type=&quot;text&quot; name=&quot;firstname&quot;&gt;&lt;br/&gt;&lt;br/&gt;
          &lt;label for=&quot;lastname&quot;&gt;Lastname&lt;/label&gt;  &lt;input type=&quot;text&quot; name=&quot;lastname&quot;&gt;&lt;br/&gt;&lt;br/&gt;
          &lt;label for=&quot;username&quot;&gt;Username&lt;/label&gt;  &lt;input type=&quot;text&quot; name=&quot;username&quot;&gt;&lt;br/&gt;&lt;br/&gt;
          &lt;label for=&quot;fb_id&quot;&gt;FaceBook ID&lt;/label&gt;  &lt;input type=&quot;text&quot; name=&quot;fb_id&quot;&gt;&lt;br/&gt;&lt;br/&gt;
          &lt;label for=&quot;password&quot;&gt;Password&lt;/label&gt;  &lt;input type=&quot;password&quot; name=&quot;password&quot;&gt;&lt;br/&gt;&lt;br/&gt;
          &lt;label for=&quot;password_conf&quot;&gt;Enter Password Again&lt;/label&gt;  &lt;input type=&quot;password&quot; name=&quot;password_conf&quot;&gt;&lt;br/&gt;&lt;br/&gt;
          &lt;input type=&quot;hidden&quot; name=&quot;submitted&quot;&gt;
          &lt;input id=&quot;submit_new_admin&quot; type=&quot;button&quot; value=&quot;Add As Admin&quot;&gt;
      &lt;/form&gt;
  </code></pre>
  <p>What I am trying to do witht eh Jquery is pass the value of the text inputs.</p>
  <h3>example</h3>
  <pre><code>data: { request: 'add_new_admin', firstname: [firstname value from form], lastname: [lastname value from form], username: [username from form]} and so on.
  </code></pre>
  <p>How can I do this?</p>