Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

why axios get method request send twice?

Tags:

vue.js

enter image description hereI run the axios get method to call php script.but request send twice how to solve this problem. myfunction:-

   axios.get('http://13.233.179.174/customers_log.php',{
                  headers: {
                    'Access-Control-Allow-Origin': '*'
                  },
                })
                  .then(function (response) {
                    $("#spinner").hide();
                    console.log('this is response work');
                    console.log(response.data);
                  })
                  .catch(function (error) {
                    $("#spinner").hide();
                    console.log(error);
                  })
like image 356
ShrJoshi Avatar asked Apr 24 '19 05:04

ShrJoshi


1 Answers

It'a Preflight request

It is an OPTIONS request, using three HTTP request headers: Access-Control-Request-Method, Access-Control-Request-Headers, and the Origin header.

Check here - https://developer.mozilla.org/en-US/docs/Glossary/Preflight_request

like image 159
arora Avatar answered Nov 16 '22 21:11

arora