I am trying to track the return value from a function call:
$('#button').on('click', function(){ console.log( getMessage(3) );
The following is ajaxFetch() , a generic ajax handler that returns the expected pending ajax object. Let's say this is a string value: 'hello' . Server response a few seconds.
function getMessage(id){ ajaxFetch(id).done(function(result){
How can I get my trace for the output of 'hello' ?
I think...
... that console.log() needs to be configured somehow as promise , but it is very difficult for me to understand jQuery documentation.
source share