title: How to call Ajax Success function variable into other function
body: <p>How to call Ajax success function variable into Other function, please have a look over the code.</p>
  
  <pre><code>var global_data;
  
      $.ajax({
          type: "post",
          url: "login.php",
          success: function (result) {
              console.log(result);
              global_data =   result;
              tick(global_data);
  
          }
      });
  
  function tick(global_data) {
          $.toast({
  
          text: '30 days club',
          icon: '',
          loader: false,        
          loaderBg: '#9EC600',  
          allowToastClose: true,
          showHideTransition: 'fade'
          })
      initMap();
      console.log ("Jerry"+global_data);
      setTimeout(tick, random(20, 24) * 1000);
  }
  </code></pre>
  
  <p>Here is the code, please have a look and after making all the changes still getting undefined in the console for function tick(global_data).   </p>