1
我使用角度爲2和離子的用戶名和密碼在我的應用程序上對用戶進行身份驗證。 當我使用subscribe
方法我得到的數據從服務器返回這樣發佈返回帶有斜線的json數據
{"_body":"[{\"FullName\」:\」user\」,\」PhoneNo\」:\」0001\」}]」,」status":200,"ok":true,"statusText":"OK","headers":{"content-type":["text/html"]},"type":2,"url":"http://webserver.com/login.php"}
與斜線的數據。
當我使用rxjx
方法未能從服務器得到任何迴應,它讀取error sending
如何解決我的劇本,所以我得到的只是像普通的JSON
[{"FullName」:」user」,」PhoneNo」:」0001」}]
數據返回
下面是我的腳本,我用它來發布到服務器
this.http.post("http://webserver.com/login.php",{'username':this.username,'password':this.password}).subscribe(data=>{
console.log(JSON.stringify(data));
},error=>{
console.log("error sending")
})