-1

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...

Bijay Rai
  • 961
  • 1
  • 12
  • 32

2 Answers2

1

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..

Bijay Rai
  • 961
  • 1
  • 12
  • 32
0

Even I am running the whole project under npm start, I got the same error message. the thing I was doing wrong was " action=" " method="post" "

  • form class="business_customer" action=" " method="post" id="contact_form" ng-submit="addDetails()"

I removed action=" " method="post" from my html and now it works perfectly

  • form class="business_customer" id="contact_form" ng-submit="addDetails()"