title: Javascript Functions and optional arguments
body: <p>I have two nearly identical javascript functions that are used to initiate a jquery $.get call. The arguments to the function are passed to the script being called.</p>
  
  <p>The problem is that one set of calls requires an additional argument that the other does not.</p>
  
  <p>To accomplish this I'm using the two nearly identical javascript functions I've mentioned. Here they are:</p>
  
  <pre><code>function process(url, domid, domain, scan_id)
  {
      $.get(url,
      {
          domain: domain,
          scan_id: scan_id
      },
  
      function(data)
      {
          $(domid).html(data);
      });
  }
  
  function process_type(url, domid, type, domain, scan_id)
  {
      $.get(url,
      {
          domain: domain,
          type: type,
          scan_id: scan_id
      },
  
      function(data)
      {
          $(domid).html(data);
      });
  }
  </code></pre>
  
  <p>As you can see, the 2nd function merely accepts an additional argument called 'type' which is then passed through the $.get call.</p>
  
  <p>I want to combine these two functions, but I'm not sure how I can optionally include that 3rd argument in that ( array / object / whatever it is in { }  ( yes, javascript noob) ) that's being passed in $.get.</p>
  
  <p>EDIT just to say.... damn, you guys are good. :D</p>