Access to variable that is returned from the $.ajax "success" setting?

Access to variable that is returned from the $.ajax "success" setting?

Hi,
I am trying to access a variable that is return from the "success" setting from an $.ajax call. I am not sure how to do this. I have attached the code below. Maybe there i a different way to get this variable?
  1. $( function( $ ){

  2. var xmlPath = '/site_media/xml/regions.xml';
  3. var regionMap;
  4. function parseXml( xml ){
  5. var map = {};
  6. $( xml )
  7. .find( 'region' )
  8. .each( function(){
  9. var regionName = $( this ).find( 'regionName' ).text();
  10. var manager = $( this ).find( 'manager' ).text();
  11. var phone = $( this ).find( 'phone' ).text();
  12. var email = $( this ).find( 'email' ).text();
  13. map[ regionName ] = {
  14. 'regionName' : regionName,
  15. 'manager' : manager,
  16. 'phone' : phone,
  17. 'email' : email
  18. };
  19. }
  20. );
  21. return map;
  22. }
  23. //get the xml
  24. options = {
  25. type: 'GET',
  26. url: xmlPath,
  27. dataType: 'xml',
  28. success: function(data){
  29. //NEED ACCESS TO THIS VARIABLE!!!
  30. regionMap = parseXml( data );
  31. },
  32. error: function(){
  33. alert( 'Could not load XML file for contact');
  34. }
  35. };
  36. $.ajax(options);
  37.       
  38.       // NO GO :(
  39.       alert( regionMap.Central );
  40. });