ShrJoshi
ShrJoshi

Reputation: 327

why axios get method request send twice?

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);
                  })

Upvotes: 6

Views: 10409

Answers (1)

arora
arora

Reputation: 869

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

Upvotes: 6

Related Questions