Hii , am using angular2 and Php as my serverside scripting language. In my 
project angular request for authentication and the server returns a result 
if it is a valid user . This returned value is then stored in localStorage 
for further operation.
In angular I used like :
 
save() // when button pressed
{
let headers = new Headers({
'Content-Type': 'application/x-www-form-urlencoded'
});
let options = new RequestOptions({
headers: headers
});
let body = 'email=' + this.Username + '&password=' + this.Password;
var a =this.http.post('http://localhost/php/login.php',body,options)
.subscribe(
(response : Response)=>{
let data = response.json();
alert(data); // it will not alert anything
this.localStorage.set('session',data);
}
);
}

in my serverside I used like :

<?php
$user = $_POST['email'];
$pass=$_POST['password'];
//check for the valid user
echo "success"; // also tried with return "success";
?>


Is there any possible solution for this ? need help

-- 
You received this message because you are subscribed to the Google Groups 
"Angular and AngularJS discussion" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/angular.
For more options, visit https://groups.google.com/d/optout.

Reply via email to