I want to check password match or not dynamically.below my code.but i didn't get success.please help me

login(){

var headers = new Headers();
headers.append(‘Content-Type’, ‘application/x-www-form-urlencoded’ );
let options = new RequestOptions({ headers: headers });

 this.http.get("http://www.spangu.com/ionic2/ionicdemo/index.php/Login/"+this.username+"/"+this.password, options)
 
  .subscribe(data => {
    //console.log(data['_body']);
    //if password match showing this message.
    alert("Login Successfully done!");
  }, error => {
    //console.log(error);
    // Error getting the data
    alert("something Wong!")
  });

};

Hey @flycoders_sourav, why doy ou perform your login that way, you could simply perfom a post and pass your user and password in the body and still be using encoded url.
And i think you’d better use data.json() which will give you the parse object of “data[’_body’]”

1 Like

Thank you for making two very insightful points here.

1 Like

Thanks a lot @rapropos, coming from you mean a lot for me :slight_smile:

@rapropos thank you.