Tag:javascript
Article From:https://segmentfault.com/q/1010000012140805
Question:

I want to make a request with Axios, but the following is the wrong report, No’Access-Control-Allow-Origin’header is present on the requested resource. ORigin’http://localhost:8085’is therefore not allowed access. The response had HTTP had 405.
Then I used the jQuery method to ask for a time, not to make a mistake, do not understand why the Axios request is wrong, because it is based on the Vue environment, so it is the first attempt to use the Axios request, hope the passing of the gods to point out a little

    axios({
      method: 'get',
      url: 'http://123.55.94.183:8091/apifit/transfer/transfer',
      responseType: 'json',
      data: PostJson({
                    fitUserId: 'belle',
                    reqTransfer: '/apifit/medal/getUser'
      })
    })
    .then(function (response) {
      console.log(response)
    })
    .catch(function (error) {
      console.log(error)
    })

Answer 0:

405It’s a request type error. Let’s see if the backend does not support the get request.

Answer 1:

No ‘Access-Control-Allow-Origin’ header is present on the requested resource.

Cross domain request error, to the back end to respond to the headAccess-Control-Allow-OriginSet up*Just fine

Similar Posts:

Link of this Article: Axios request error 405

Leave a Reply

Your email address will not be published. Required fields are marked *