Skip to content

Instantly share code, notes, and snippets.

@suneo3476
Created February 4, 2016 02:48
Show Gist options
  • Save suneo3476/d3256edc7624958f36b3 to your computer and use it in GitHub Desktop.
Save suneo3476/d3256edc7624958f36b3 to your computer and use it in GitHub Desktop.
why undefined???
var func = function(str,id){
var request = $.ajax({
type: "get",
url: "get_hogehge.php",
data: {id: id}
});
request.done(function(data){});
request.always(function(data){
var result = "仮";
console.log(result);// -> 仮
console.log(typeof(result));// -> str
return result;
});
}
var ret_func = func(str,id);
console.log(ret_func); //-> undefined
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment