$http.post 404 page not found problem on chrome browser


#1

Hello all,

I am trying to post data from a registration form to a mysql database using AngularJS together with PHP as the back-end scripting language. but when I click the button that triggers a submit() function I get a ionic.bundle.js:25000 POST ‘php file url path’ 404 (Not Found) error on chrome browser console.

Please I need help with resolving this as I am unable to access the php file that would have posted the collected data to a mysql database.

In the app.js file here is script for the post request:

app_ii = angular.module('regbdy', ['ionic']);

app_ii.controller('regCtrl', function($scope, $http) {
    $scope.submit = function(){
            var url = "php/reg_form.php";
            var fdata = {
                        headers: { 'Content-Type': 'application/x-www-form-urlencoded; charset=UTF-8'},
                        cache: false,
                        fname : $scope.fname,
                        lname : $scope.lname,
                        phone : $scope.phone,
                        email: $scope.email,
                        password : $scope.password,
                        ver_password: $scope.ver_password
                      };  
            var request = $http.post(url, fdata);
              
            request.success(function (data) {
              console.log(data);
            });
        }
});

I am building the app using ionic on Cloud 9 IDE.