My code:
function validateAddress(type){
var status = true
if(type == 0 || type == 2){
$.get( "/user/status/0", function( data ) {
if(!data.status){
status = false
}
else
status = true
});
}
else{
$.get( "/status/1", function( data ) {
if(!data.status){
status = false;
}
else{
status = true
}
});
}
console.log(status)
return status
}
How to make sure the internal status is returned from function? At the moment it returns true all the time, because somehow the status value isn't changed. The AJAX part itself is working fine.