在AngularJS中,我有以下功能,它工作正常:
$http.get( "fruits.json" ).success( $scope.handleLoaded );
Run Code Online (Sandbox Code Playgroud)
现在我想将它从一个文件更改为一个url(使用一些甜蜜的Laravel 4返回json):
$http.get( "http://localhost/fruitapp/fruits").success( $scope.handleLoaded );
我得到的错误是:
"NetworkError: 405 Method Not Allowed - http://localhost/fruitapp/fruits"
Run Code Online (Sandbox Code Playgroud)
有什么问题?是因为fruit.json是"本地"而localhost不是?
从w3:
10.4.6 405 Method Not Allowed
The method specified in the Request-Line is not allowed for the resource
identified by the Request-URI. The response MUST include an Allow header
containing a list of valid methods for the requested resource.
Run Code Online (Sandbox Code Playgroud)
它表示URL:http://localhost/fruitapp/fruits
服务器正在响应GET
不允许该 方法.是一个POST
还是PUT
?
归档时间: |
|
查看次数: |
48460 次 |
最近记录: |