I have to make numerous AJAX calls and want to set up a simple method to handle this. I created the following
function testingAjax(url) {
  $.ajax({
    type: "GET",
    contentType: "application/json; charset=utf-8",
    url: url,
    data: "{}",
    dataType: "json",
    success: function(data) {
      //alert(data);
      return data;
    },
    error: function(err) {
      alert('error')
    }
  });
};
When I call testingAjax from another method, I get an Undefined error, yet when I alert from within testingAjax it is correct.
function testingCall(){
    var data = testingAjax(url);
    alert(data);
}
Basically, I want to return the data from the AJAX call, and parse it elsewhere. What am I doing wrong?
 
    