I am using angular.js for my project and i wrote one service in which I have return patient details but in controller i am not getting this return value by patientinfo() function call. here is my service code:
app.service('PatientDetailService', function() {
this.patientinfo = function(){
$.ajax({
dataType: "json",
url: "json/client_info.json",
type: 'get',
error: function(patientdetail){ alert("error");},
success: function(patientdetail){
alert("successs");
console.log(patientdetail);
return patientdetail;
}
});
}
});