Scope problem, trying to figure out.

Scope problem, trying to figure out.

Hi guys,

I'm trying to get an XML through the Ajax function of Jquery, the code is something like this :


  1. function getXML() {
  2.  
  3. var XMLResponse = $.ajax({
  4.         type: "GET",
  5. url: "teste.xml",
  6. dataType: "xml" 
  7. });
  8. var Xml;
  9. XMLResponse.success(function(data){Xml = data;});
  10. console.log(Xml);
  11.                         // I would like to put here a return(Xml); but it goes as undef to the console.
  12. }   
I'm sure I have an scope problem over there, just don't know how to go around.

I just would like to spit the xml Jquery object. That would be nice. There is a quicker/nicer way to do it? or at least one that works?

Thanks,
Samir