javascript - JSONP request error Angular 2 -


i making jsonp request in angular 2. response when click on link of error message, unable output response browser, error:

uncaught response status: 200 ok url: https://www.statbureau.org/calculate-inflation-price-jsonp?jsoncallback&country=united-states&amount=102&start=1968%2f1%2f1&end=2016%2f1%2f1

import {component} '@angular/core'; import {navcontroller} 'ionic-angular'; import {jsonp, urlsearchparams } '@angular/http'; import {jsonp_providers} '@angular/http'; @component({   templateurl: 'build/pages/home/home.html',   providers: [jsonp_providers] }) export class homepage {    value: any;   constructor(private jsonp: jsonp) {     this.jsonp=jsonp;         let cpiurl = "https://www.statbureau.org/calculate-inflation-price-jsonp?jsoncallback"          let params = new urlsearchparams();       params.set('country', 'united-states');       params.set('amount', '102');         params.set('start', '1968/1/1');         params.set('end', '2016/1/1');       params.set('format', 'true');         // todo: add error handling          this.jsonp                .request(cpiurl, { method: 'get', search: params }).subscribe(res => { this.value = res.json();                })      }   } 

import {component} '@angular/core'; import {navcontroller} 'ionic-angular'; import {urlsearchparams } '@angular/http'; import {http, http_providers} '@angular/http'; @component({   templateurl: 'build/pages/home/home.html',   providers: [http_providers] }) export class homepage {    value: any;   constructor(private http: http) {     this.http=http;         let cpiurl = "https://www.statbureau.org/calculate-inflation-price-json?"          let params = new urlsearchparams();       params.set('country', 'united-states');       params.set('amount', '102');         params.set('start', '1968/1/1');         params.set('end', '2016/1/1');       params.set('format', 'true');         // todo: add error handling          http.get(cpiurl, {search: params }).subscribe(res => { this.value = res.text();                })      }   } 

Comments

Popular posts from this blog

javascript - Slick Slider width recalculation -

jsf - PrimeFaces Datatable - What is f:facet actually doing? -

angular2 services - Angular 2 RC 4 Http post not firing -