Why my $.ajax showing “preflight is invalid redirect error”?

后端 未结 8 686
花落未央
花落未央 2020-11-28 11:04

I tried the following code in Postman and it was working. Is there something wrong with the code?

$.ajax({
   url: \'http://api.example.com/users/get\',
   t         


        
相关标签:
8条回答
  • 2020-11-28 11:37

    My problem was that POST requests need trailing slashes '/'.

    0 讨论(0)
  • 2020-11-28 11:38

    I received the same error when I tried to call https web service as http webservice.

    e.g when I call url 'http://api.example.com/users/get'
    which should be 'https://api.example.com/users/get'
    

    This error is produced because of redirection status 302 when you try to call http instead of https.

    0 讨论(0)
提交回复
热议问题