试图在Laravel中使用AngularJS发送发帖请求,我收到此错误消息:
抱歉,找不到您要查找的页面。
JAVASCRIPT
app.controller('main',['$scope','$http','$httpParamSerializerJQLike',function($scope,$http,$httpParamSerializerJQLike) {
$scope.courses = [];
$http({
url: "/afil",
method: "POST",
headers: {'Content-Type': 'application/x-www-form-urlencoded',"X-Requested-With":"XMLHttpRequest"},
data: $httpParamSerializerJQLike()
}).success(function(res) {
console.log(res);
// $scope.courses = res;
}).error(function(res) {
});
}]);
routes.php
Route::post('/afil', function () {
return 'Hello World';
});
检查您的表单操作url是否正确,如果您在路由中使用了组前缀,请不要忘记将其包含在表单操作url中
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句