我有以下代码:
$("#get_details").click(function(){
name = $("#user_name").val();
var age,gender;
$.post("users.php", { name: name },
function(data){
if (data.status == 'success'){
age = data.message[0];
gender = data.message[1];
alert(age); //getting output
}
}, "json");
alert(age);//doesn't getting output
});
我想在外部访问这些值$.post()
,为此我需要修改什么?