Javascript $http.get返回根页面(&;拉维尔
我有这个角度代码Javascript $http.get返回根页面(&;拉维尔,javascript,php,angularjs,laravel,routing,Javascript,Php,Angularjs,Laravel,Routing,我有这个角度代码 var loginApp = angular.module('login', []); loginApp.controller('loginCtrl', function($scope, $http) { $scope.password = ""; $scope.email = ""; $scope.doLogin = function() { if($scope.password.trim() != "" &&
var loginApp = angular.module('login', []);
loginApp.controller('loginCtrl', function($scope, $http)
{
$scope.password = "";
$scope.email = "";
$scope.doLogin = function()
{
if($scope.password.trim() != "" && this.isEmailValid())
{
$http.get('/AuthLogin')
.success(function(response)
{
console.log(response);
})
.error(function(error)
{
alert(error);
});
}
}
});
以下是laravel routes.php:
<?php
Route::get('/AuthLogin', function()
{
return 'success';
});
App::missing(function($exception)
{
Blade::setContentTags('<%', '%>'); // for variables and all things Blade
Blade::setEscapedContentTags('<%%', '%%>'); // for escaped data
return View::make('index');
});
?>
问题是我得到的是主根/
页面作为$http.get
的响应,而不是“success”。为什么?
谢谢 尝试以下方法: 以管理员身份运行cmd.exe 键入“netsh winsock reset”,然后按enter键
重新启动电脑尝试添加斜杠:$http.get('//AuthLogin')@IlyasMimouni我收到一个错误:get net::ERR\u NAME\u NOT\u RESOLVEDok,直接在navigator:localhost/AutoLogin中尝试。如果这不起作用,那么问题就在路线上。仍然是一样的。谁在制造问题?我认为它在IE中可以工作,但在firefox或chrome中不行,所以请在帖子中试试这个方法。