formed working AJAX function to return console.log