Value inserted properly but showing an error


#1

Value inserted properly but showing an error below my error and come
Response with status: 0 for URL: null
Below my code

submitData() {
    let datatopost:any = {};
    if(this.MySelect1.length>0  || this.MySelect1.length == 0) {
      for(let i=0; i<=this.MySelect1.length; i++) {
        datatopost = {"name":this.doc_name[i],"address":this.doc_add[i],"contact":this.doc_cont[i]};
        this.post_to_server.push(datatopost);

      }
        console.log("Final Data...");
       this.http.post("http://www.mydomain.com/multiplefield/saveImage.php",JSON.stringify(this.post_to_server))
      .subscribe(data => {
       let temData =data.json()
       alert(data)
        let response = temData.code;
         this.post_to_server.pop();
      }, error => {
        
        // Error getting the data
        console.log(error);
        alert(error)
        this.post_to_server.length =0;
      });
  }
 }

#2

Hi@flycoders_sourav
The issue is with your URL,in the post request.Seems the http POST is not working.Thats why you cannot access or get data


#3

but value inserted properly


#4

Hi@flycoders_sourav
Try to use ‘any’ like this in the observable

.suscribe((data:any)=>{
        console.log('success');
  },error=>{
         console.log('error');
  });