简体   繁体   English

Ionic Angular Js向服务器发出2个请求

[英]Ionic Angular Js making 2 requests to server

Using Ionic framework 1, 使用Ionic框架1,

Making request using $http.post(); 使用$http.post();发出请求$http.post(); but, in the console.. two requests are getting generated. 但是,在控制台中..正在生成两个请求。

the first request doesn't contain the POST parameters and is blank , while the second request contains the POST parameters as passed to $http.post() method. 第一个请求不包含POST参数,并且为空,而第二个请求包含传递到$http.post()方法的POST参数。

What could be the possible reason ? 可能是什么原因? May be it's checking if already cached resource is updated or not by making a blank request to the server, before making a request to load data . 可能是在请求加载数据之前,通过向服务器发出空白请求来检查是否已更新已缓存的资源

But, I have not enabled any caching or anything. 但是,我尚未启用任何缓存或任何功能。 Everything is default. 一切都是默认的。

在此处输入图片说明

The first request is the Request Method: OPTIONS request. 第一个请求是“ Request Method: OPTIONS请求。 It checks whether or not the actual request is safe to send. 它检查实际请求是否可以安全发送。 It is also called 'preflighted request' 也称为“预检请求”

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM