I want to open an XML file using jQuery, but I have an undefined error when I want to display the value of open outside the function.
Here is the code :
$(document).ready(function () {
    var open ;
    $.ajax({
    
      type: "GET",
      url: "../build/js/openTickets.xml",
      dataType: "xml",
      success: nv =function(xml) {
        $(xml).find("mestickets").each(function () {
            var open =$(this).find("nbopenTickets").text();  
            console.log(open); // it works
  
        });
      }
    })
    console.log(open);//undefined
 
     
    