Ich versuche http Post mit ionischen 2 zu verwenden, aber ich kann nicht Parameter an den Serverionic2 HTTP-Post nicht zu senden Parameter
import {Http, Headers, RequestOptions} from "@angular/http";
import 'rxjs/add/operator/map';
constructor(public navCtrl: NavController, public navParams: NavParams, public shareServices: ShareServices, public http: Http) {
this.data = {};
this.data.email = '';
this.data.password = '';
}
login()
{
let url = 'http://localhost/wp/ap/user/generate_auth_cookie/?insecure=cool';
var headers = new Headers();
headers.append("Accept", 'application/json');
headers.append('Content-Type', 'application/x-www-form-urlencoded');
let options = new RequestOptions({ headers: headers });
let body = {
email : this.data.username,
password : this.data.password,
}
this.http.post(url,JSON.stringify(body), options).map(res => res.json()).subscribe(
data => {
this.resp = data.json();
console.log('RESP', this.resp);
},
err => {
this.resp = err.json();
console.log('ERROR', this.resp);
}
);
}
Ich bin mit Wordpress User-Api Plugin
senden
alle Fehler, die Sie haben? – Sampath
Nein, es gibt keine Fehler gefunden – MSalah