PHP未响应Angularjs请求
我有一张原始表格,上面有一些angularjs验证PHP未响应Angularjs请求,php,angularjs,Php,Angularjs,我有一张原始表格,上面有一些angularjs验证 <form name = "sform" novalidate="true"> <table border="0"> <tr> <td> First name: </td> <td> <input type="text" name="fname" ng-model=
<form name = "sform" novalidate="true">
<table border="0">
<tr>
<td>
First name:
</td>
<td>
<input type="text" name="fname" ng-model="fname" placeholder="First Name" required="true" ng-pattern="/^[A-Za-z]*$/">
</td>
<td ng-show="sform.fname.$invalid && !sform.fname.$pristine" class="help-block">wrong name </td>
</tr>
<tr>
<td>
Last Name:
</td>
<td>
<input type="text" ng-model="lname" placeholder="last Name" required="true" ng-pattern="/^[A-Za-z]*$/">
</td>
<td ng-show= "sform.lname.$invalid && !sform.lname.$pristine" class="help-block">wrong Last name </td>
</tr>
<tr>
<td>
Email:
</td>
<td>
<input type="email" ng-model="email" placeholder="email" required="true">
</td>
<td ng-show="sform.email.$invalid && !sform.email.$pristine" class="help-block">wrong Email </td>
</tr>
<tr>
<td>
<button type="submit" ng-disabled="sform.$invalid" ng-click = "submitForm()">Submit</button>
</td>
</tr>
</table>
</form>
far\u formcontroller.js
var farLogin = angular.module('far_login',[]);
farLogin.controller('far_formcontrol',['$scope','$http',function($scope,$http) {
$scope.url='http://localhost/far_submit.php';
var config = {
headers : {
'Content-Type': 'application/x-www-form-urlencoded;charset=utf-8;'
}
}
// function to submit the form after all validation has occurred
$scope.submitForm = function() {
alert('our form is amazing'+$scope.fname+' '+$scope.email+' '+$scope.lname);
// check to make sure the form is completely valid
if ($scope.sform.$valid) {
$http.post($scope.url,{"name": $scope.fname, "email": $scope.email, "lname": $scope.lname},config).
success(function() {
alert('our form is amazing'+$scope.fname+' '+$scope.email+' '+$scope.lname);
})
}
else
{
alert('our form is not amazing');
}
}
}]);
我的php文件是
<?php
header("Access-Control-Allow-Origin: *");
?>
<script type="text/javascript"> alert("this is php")</script>
<?php
?>
警报(“这是php”)
但是php脚本根本没有执行,并且在浏览器的控制台中也没有错误
我错在哪里
多谢各位