NetworkError:405不允许的方法AngularJS REST [英] NetworkError: 405 Method Not Allowed AngularJS REST

查看:333
本文介绍了NetworkError:405不允许的方法AngularJS REST的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在AngularJS,我有以下功能,这工作得很好:

In AngularJS, I had the following function, which worked fine:

$http.get( "fruits.json" ).success( $scope.handleLoaded );

现在我想从一个文件更改为一个URL(即返回使用一些甜蜜的Laravel 4 JSON):

Now I would like to change this from a file to a url (that returns json using some sweet Laravel 4):

$ http.get(HTTP://本地主机/ fruitapp /水果).success($ scope.handleLoaded);

我得到的错误是:

"NetworkError: 405 Method Not Allowed - http://localhost/fruitapp/fruits"

这是什么问题?是不是因为fruit.json是本地和本地主机是不是?

What's the problem? Is it because fruit.json was "local" and localhost is not?

推荐答案

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.

这意味着对于网址:的http://本地主机/ fruitapp /水果服务器响应的 GET 方法是不允许的。它是一个 POST PUT

It means the for the URL: http://localhost/fruitapp/fruits The server is responding that the GET method isn't allowed. Is it a POST or PUT?

这篇关于NetworkError:405不允许的方法AngularJS REST的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆