Bijay Rai Bijay Rai - 7 months ago 223
PHP Question

POST 404 Not found.. Angular js

here i'm sending data through $http.post to data/user.php

app.factory('loginService',function($http){
return{
login:function(data,scope){
var $promise=$http.post('data/user.php',data); //send data to user.php
$promise.then(function(msg){
if(msg.data=='succes') scope.msgtxt='Correct information';
else scope.msgtxt='incorrect information';
});
}
}

});


data/user.php code

<?php
$user=json_decode(file_get_contents('php://input')); //get user from
if($user->mail=='elgaliamine@gmail.com' && $user->pass=='1234')
print 'succes';
else
print 'error';
?>


and browser continuously showing mePOST
http://localhost:8000/app/data/user.php 404 (Not Found)

while m trying
http://localhost:8000/app/data
then it shows there exist
user.php


Why its giving 404 error?? please do help me...

Answer

i got solution... actually i am running this whole project under npm start

http://localhost:8000/app/index.html?#/login

so am getting that 404 error

now i've open it under apache

http://localhost/login/app/index.html?#/login

its working now..