I have a document.ready function like this;
  function myfun(){
    var xx;
    $.ajax({
        type: 'POST',
        url: 'handler.php',
        cache: false,
        success: function(result) {
          xx = result;
        },
    });
    return xx;
  }
  var a;
  a = myfun();
  alert(a);
handle.php is set to echo 1234. But I am getting alert as "undefined". How can I fix this? Expected alert is "1234" (the reply from ajax handler).
 
     
     
     
     
    