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

How to handle data 'null' problem in web service response?

$
0
0

@anespa wrote:

Dear Friends,

I am using a local web service in my company to take some data through web service…

I installed Core plugin for firefox so that CORS problem avoided…

i got response from server as ‘null’

my .ts file function

getAssessment(event)
    {
      var link = 'http://172.16.8.70/web/sanchayarestservice/index.php/sanchaya/ward/id/';
      var obj = {lbid: event};
      var myData = JSON.stringify(obj);
      this.http.post(link,myData,{ headers: new HttpHeaders()
        ,responseType: 'json'
      } ).subscribe(data => {
        alert(data);
        this.data.response = data;
        }, error => {
        console.log("Oooops!");
        });



    }

my html part

<ion-item>
  <ion-label>Local Body Name</ion-label>
  <ion-select formControlName="lbname" [(ngModel)]="data.lbname" (ionChange)='getAssessment($event)'>
    <ion-option value="15" checked="true">Sasthamkotta</ion-option>
    <ion-option value="26">Chadayamangalam</ion-option>
    <ion-option value="27">Pulikeezhu</ion-option>
  </ion-select>
</ion-item>

response show part in html below

<ion-card>
<ion-card-header>
Response
</ion-card-header>

<ion-card-content>
<b>{{data.response}}</b>
</ion-card-content>
</ion-card>
 </ion-content>

Please advise .

Thanks

Anes

Posts: 1

Participants: 1

Read full topic


Viewing all articles
Browse latest Browse all 70432

Trending Articles



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