title: jQuery Ajax Call function
body: <p>I want to be able to call a function from the "on success" region instead of having to place my code in that region. I'll be using the code twice so I'm trying to figure out how to place it outside of the jQuery.ajax() function.</p>
  
  <p>Here is my current code:</p>
  
  <pre><code>$.ajax({
    type: "GET",
    url: "ws/getweather.ashx?zip=" + vZip,
    dataType: "xml",
    success: function (xml) {
    $(xml).find('weather').each(function () {
       // Load New Data
       ...
  });
  },
    error: function (xml) {
      alert("Unrecognized Region. Please try again.");
    }
  });       
  </code></pre>
  
  <p>So instead of having...</p>
  
  <pre><code>function (xml) {
    $(xml).find('weather').each(function () {
       // Load New Data
       ...
  });
  </code></pre>
  
  <p>I'd like to put the name of another function, and pass the xml to that function. That way I can have other events call the same set of code.</p>
  
  <p>Thanks in advance!</p>
  
  <p>UPDATE===================================================</p>
  
  <p>Thanks to Mike Richards for his timely response. I'm including the exact syntax below because I had to add a few details to make it work...meaning, pass the XML to the other function.</p>
  
  <pre><code>$.ajax({
  type: "GET",
  url: "ws/getweather.ashx?zip=32751",
  dataType: "xml",
  success: function (xml){
      weatherize(xml);
  },
  error: function (xml) {
      alert("Unrecognized Region. Please try again.");
  }
  });
  </code></pre>
  
  <p>And then somwhere below, my other function</p>
  
  <pre><code>function weatherize(xml) {
    $(xml).find('weather').each(function () {
  // Load New Data
  ...
  })
  };
  </code></pre>