title: Passing a callback function with included parameters?
body: <p>I have this below code..</p>
  
  <pre><code>function getGrades(grading_company) {
  
      if (grading_company == 'Not Specified') {
  
          // Remove grades box &amp; show condition box
          showConditionBox();
  
      } else {
  
          // Set file to get results from..
          var loadUrl = "ajax_files/get_grades.php";
  
          // Set data string
          var dataString = 'gc_id=' + grading_company;
  
          // Set the callback function to run on success
          var callback = showGradesBox;
  
          // Run the AJAX request
          runAjax(loadUrl, dataString, callback);  
  
      }
  
  }
  
  function runAjax(loadUrl, dataString, callback) {
  
      jQuery.ajax({
          type: 'GET',
          url: loadUrl,
          data: dataString,
          dataType: 'html',
          error: ajaxError,
          success: function(response) {
              callback(response);
          }
      });    
  
  }
  </code></pre>
  
  <p><strong>Edit:</strong> Here is the function that gets called as the callback function:</p>
  
  <pre><code>function showGradesBox(response) {
  
      // Load data into grade field
      jQuery('#grade').html(response);
  
      // Hide condition fields
      jQuery('#condition').hide();
      jQuery('#condition_text').hide();
  
      // Show grade fields
      jQuery('#grade_wrapper').show();
      jQuery('#grade_text_wrapper').show();    
  
  }
  </code></pre>
  
  <p>Now if I wanted to pass the <code>grading_company</code> variable to the callback function as a parameter is there a way to do that without having to add it as another parameter in the <code>runAjax</code> call? I'm trying to keep the <code>runAjax</code> function open to other usage so I don't want to pass in any extra parameters; but if it can somehow be included within the callback then great.</p>