在 AngularJS 中,我有以下功能,运行良好:
$http.get( "fruits.json" ).success( $scope.handleLoaded );
现在我想将其从文件更改为 url(使用一些可爱的 Laravel 4 返回 json):
$http.get( "http://localhost/fruitapp/fruits").success( $scope.handleLoaded );
我得到的错误是:
"NetworkError: 405 Method Not Allowed - http://localhost/fruitapp/fruits"
有什么问题?是因为 Fruit.json 是“本地”而 localhost 不是吗?
From w3 http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html:
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.
这意味着 URL 的:http://localhost/fruitapp/fruits
服务器正在响应GET
方法不被允许。是不是一个POST
or PUT
?
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)