Answer the question
In order to leave comments, you need to log in
How to make HTTP request in angular to php file?
How to make an HTTP request in angular to a php file that is on a local server
. For example, my user.php file contains:
<?php
function get_name()
{
$arr = ['dima', 'nikita'];
exit(json_encode($arr);
?>
this.http.get('../php/user.php')
.subcribe((response) => {
console.log(response);
})
Answer the question
In order to leave comments, you need to log in
this.http.get('../php/user.php')
this.http.get('/user.php')
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question