Quantcast
Channel: Ionic Forum - Latest topics
Viewing all articles
Browse latest Browse all 71531

Error o receiving JSON object

$
0
0

@riteshbhat17 wrote:

This is the object which i am receiving from API
{"up_votes":"1","down_votes":"0"}

using http.get to receive data in app, home.ts

..
public vote_response:any={};
...
this.http.get(this.baseURI+'votesNum.php?'+this.question.question_id)
        .subscribe(result =>{this.vote_response = result.json();});

this is the error which i am receiving:

ERROR SyntaxError: Unexpected token < in JSON at position 0
    at JSON.parse (<anonymous>)
    at Response.Body.json (http.es5.js:800)
    at MapSubscriber.project (forum-quest-details.ts:44)
    at MapSubscriber._next (map.js:77)
    at MapSubscriber.Subscriber.next (Subscriber.js:89)
    at XMLHttpRequest.onLoad (http.es5.js:1229)
    at t.invokeTask (polyfills.js:3)
    at Object.onInvokeTask (core.es5.js:4119)
    at t.invokeTask (polyfills.js:3)
    at r.runTask (polyfills.js:3)

Can anyone help me solve this issue.

Posts: 1

Participants: 1

Read full topic


Viewing all articles
Browse latest Browse all 71531

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>