jquery getJSON issue

jquery getJSON issue

  1. is_loggedin: function () {
  2.             var status = false;
  3.             $.getJSON('/api/isloggedin/',function(res){
  4.                 if(res.user_status){status = true;}
  5.             });
  6.             return status;
  7.         }
in this case status returns always false. even user_status is true. what is wrong here? or should i re check my server-side.

thank you