Dismiss
Announcing Stack Overflow Documentation

We started with Q&A. Technical documentation is next, and we need your help.

Whether you're a beginner or an experienced developer, you can contribute.

Sign up and start helping → Learn more about Documentation →

I Have Tried

http.get('http://192.168.0.26:9000/api/task/counttask?projectid=-1&Teamid=-1&RoleId=-1&status=1&PID=-1&mytasks=0&alltasks=0&page=1&row=15&priorityid=-1&typeid=-1&taskname=&JSON&_=1471520478215')

    .map((res: Response) => res.json())
    .subscribe(res => this.result = res); 
     alert(this.result);

I am Getting Error But if You run this below Url in Browser it will give you the output

192.168.0.26:9000/api/task/counttask?projectid=-1&Teamid=-1&RoleId=-1&status=1&PID=-1&mytasks=0&alltasks=0&page=1&row=15&priorityid=-1&typeid=-1&taskname=&JSON&_=1471520478215

How to Handle this Request ??

share|improve this question
    
In your map function, it shouldn't be .map((res) => res.json())? – Qianyue Aug 19 at 8:22
    
What i have to give on that place ? – Gopinath K Aug 19 at 8:24
    
(res: Response) => res.json() is not correct in syntax. I think that it should be res => res.json() – Qianyue Aug 19 at 8:26
    
(res: Response) => res.json() is totally fine and won't make any difference in the produced JavaScript – j2L4e Aug 19 at 8:27
    
@j2L4e Give me some i idea ... post the answer with the below url ... i will upvote ... – Gopinath K Aug 19 at 8:29
up vote 1 down vote accepted

First things first: It'd be nice to know the actual error.

Your alert() is executed right away. So the request hasn't finished yet. Try this:

.subscribe(res => {
  this.result = res;
  console.log(this.result);
}); 

edit: you should use console.log (or an actual debugger), because alert() does not resolve objects. It might just say "[object Object]".

share|improve this answer
    
Thanks I will check it and let You know ... – Gopinath K Aug 19 at 8:32
    
Getting Success Call Back ... But i want to get the result ... – Gopinath K Aug 19 at 10:00
    
Thanks a lot Its Working ... I cannot upvote because it needs atleast 15 reputation .... – Gopinath K Aug 19 at 10:33

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.