I already developed ionic 4 in my Mac. When trying to improve an app in ionic 3, my http.post
(angular) calls in php is received as GET ($ _SERVER ['REQUEST_METHOD'])
. I discovered that my parameters are not being recognized in php. * I read the other posts and none solved my problem Thank you!
import { Http , Headers, RequestOptions} from '@angular/http';
import 'rxjs/add/operator/catch';
import 'rxjs/add/operator/toPromise';
let parametros = JSON.stringify({
idtApostador: localStorage.getItem("idtApostador"),
});
let headers = new Headers(
{
'Content-Type' : 'application/json'
});
let options = new RequestOptions({ headers: headers });
return new Promise(resolve => {
this.http.post(url, parametros, options)
.timeout(15000)
.subscribe(data => {
})
})
I ask, I answer. :) https instead of http.
Use
import { HttpClient } from '@angular/common/http';
Instead of HTTP
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.