$http.get , $http.post , $http.put , $http.delete $http.head 和 $http.jsonp 之间的区别 [英] Difference between $http.get , $http.post ,$http.put , $http.delete $http.head and $http.jsonp

查看:30
本文介绍了$http.get , $http.post , $http.put , $http.delete $http.head 和 $http.jsonp 之间的区别的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是 angular js 和 web 开发的新手.请帮帮我.

I am new to angular js and web development. Please help me.

今天我在 angular js 中阅读了 $http,但我只知道 get 和 post 方法.

Today i read about $http in angular js but i am only aware about the get and post methods .

请任何人解释一下,我有什么区别 $http.get , $http.post ,$http.put , $http.delete $http.head 和 $http.jsonp

Can Please anyone explain ,me what is the Difference between $http.get , $http.post ,$http.put , $http.delete $http.head and $http.jsonp

所有这些以及何时使用.

all of them and when to use.

提前致谢.

推荐答案

HTTP GET 请求是当您在浏览器中输入 URI 或单击网页上的链接.某些 HTML 元素,例如也会生成 GET 请求.GET 从服务器请求资源(通常是网页或图像).您可以通过在脚本后添加查询参数"将其他信息传递给服务器端脚本,例如 example.com?foo&bar=42.

An HTTP GET request is what you get (pardon the pun) when you enter a URI in your browser or when you click on a link on a web page. Certain HTML elements, like also generate GET requests. GET requests a resource (usually a web page or an image) from the server. You can pass additional information to a server-side script by adding 'query parameters' after the script, such as example.com?foo&bar=42.

POST 请求类似于 GET 请求.不同之处在于任何附加信息都在请求正文中发送,而不是作为 URI 的一部分发送.您可以使用 HTML 中的元素生成 POST 请求,其中表单字段值在请求正文中发送.

A POST request is similar to a GET request. The difference is that any additional information is sent in the body of the request, rather than as part of the URI. You can generate POST requests using elements in HTML, where the form field values are sent in the request body.

HEAD 请求也类似于 GET 请求,但服务器仅使用 HTTP 标头进行响应;响应正文为空.

A HEAD request is also similar to a GET request, but the server responds only with the HTTP headers; the response body is empty.

PUT 请求是一种将文件上传到服务器的方式.由于安全隐患,大多数服务器不允许 PUT 请求.

A PUT request is a way to upload a file to a server. Most servers don't allow PUT requests, because of the security implications.

同样,DELETE 请求将删除服务器上的资源.像 PUT 一样,由于显而易见的原因,这种方法在服务器上很少被允许.

Similarly, a DELETE request will delete a resource on the server. Like PUT, this method is rarely permitted on server for obvious reasons.

来源:http://www.sitepoint.com/forums/showthread.php?526956-what-are-GET-POST-PUT-and-DELETE-HTTP-request-and-how-to-use-他们

对于jsonp,我会说看看维基百科的解释.但它基本上是一种允许您通过 XMLHttpRequest 进行跨域请求的技术.

For jsonp I would say to take a look at wikipedia explanation. But it's basically a technique that allows you to make cross-domain requests via XMLHttpRequest.

这篇关于$http.get , $http.post , $http.put , $http.delete $http.head 和 $http.jsonp 之间的区别的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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