I made a form with angularJS validation and my code is working fine in localhost. When I try to upload my whole code on my web server, I encounter a 403 Error ( Forbidden ) on line 72 of my angular.min.js file.
I tried A LOT of solutions and I am stuck on this problem.
Here is what I have in my javascript file, the problem seems to come from my server or there as I don't even get into my insert.new.php file due to this 403 error.
function FrmController($scope, $http) {
$scope.errors = [];
$scope.msgs = [];
$scope.titles = [];
$scope.SignUp = function() {
$scope.errors.splice(0, $scope.errors.length); // remove all error messages
$scope.msgs.splice(0, $scope.msgs.length);
$scope.titles.splice(0, $scope.titles.length);
$http.post('insert.new.php', { 'uname': $scope.username, 'email': $scope.useremail }).success(function(data, status, headers, config) {
if (data.msg != '') {
$scope.titles.push(data.title);
$scope.msgs.push(data.msg);
sendContactForm();
} else {
$scope.titles.push(data.title);
$scope.errors.push(data.error);
sendContactForm();
}
}).error(function(data, status) { // called asynchronously if an error occurs
// or server returns response with an error status.
$scope.titles.push(data.title);
$scope.errors.push(status);
sendContactForm();
});
}
}
I tried to put a .htaccess at the root of my website, the file contains
Order Allow,Deny
Allow from all
I didn't change anything on my webserver itself, it has a "firewall" that i tried to disable in case it could help, but that didn't solve anything.
Using AngularJS 1.2.3 (this version is the highest version that works with this code)
When I submit, in the "source" tab of chrome I get :
angular.min.js:72 POST http://domain.com/insert.new.php 403 (Forbidden)
angular.min.js:72 XHR finished loading: POST
"http://domain.com/insert.new.php".
I think there is a big chance that it has something to do with apache / the configuration of my server, but I cant solve it and nothing that I found until now did help me.