I got the same issue when I called the get method. please help me out
my code is:
var link =‘http://192.168.0.114/Service1.svc/GetLoginDetails/?Username=’ + EmpID + ‘&?Password=’ + password +’&?UDID=’+this.device.uuid + ‘&?Key=as23jk8410bnmklivvui’;
or
var link ='http://192.168.0.114:81/Service1.svc/GetLoginDetails/?Username=' + EmpID + '&?Password=' + password +'&?UDID='+this.device.uuid + '&?Key=as23jk8410bnmklivvui';
let headers = new Headers();
headers.append('Content-Type', 'application/json');
this.http.get(link).map(res => res.json()).subscribe(data => {
alert("inside response")
alert(data.GetLoginDetailsResult.Result);
if (data.GetLoginDetailsResult.Username != undefined && data.GetLoginDetailsResult.Username !="") {
this.sqlite.create({
name: 'employeeDetails.db',
location: 'default'
})
.then((db: SQLiteObject) => {
db.executeSql('CREATE TABLE IF NOT EXISTS user_detail(id INTEGER PRIMARY KEY AUTOINCREMENT,emp_id text,password text,udid text,name text,email text,phone_no text,designation text)', {})
.catch(e => console.log(e));
db.executeSql('INSERT INTO user_detail(emp_id,password,udid,name,email,phone_no,designation) VALUES(?,?,?,?,?,?,?)', [data.GetLoginDetailsResult.Username,data.GetLoginDetailsResult.Password,data.GetLoginDetailsResult.UDID
,data.GetLoginDetailsResult.FirstName,data.GetLoginDetailsResult.Email,data.GetLoginDetailsResult.Mobile,data.GetLoginDetailsResult.Designation])
.catch(e => console.log(e));
db.executeSql('select * from user_detail',[]).then((data) => {
}, (err) => {
this.loading.dismiss();
alert('Contact developer: '+JSON.stringify(err));
// alert('Unable to execute sql: '+JSON.stringify(err));
});
})
.catch(e => console.log(JSON.stringify(e)));
this.loading.dismiss();
}
else {
this.loading.dismiss();
this.toast.show('Unable to login, check Emp Id and password.', '3000', 'bottom').subscribe(
toast => {
});
}
}, error => {
this.loading.dismiss();
alert("service:"+error.json());
});
I can’t find out where I’m getting wrong.,
its ruined my time.