AngularJS With Asp.net Web API: $http post returning XMLHttpRequest cannot load: Response for preflight has invalid HTTP status code 405

前端 未结 2 439
抹茶落季
抹茶落季 2020-12-30 08:36

When trying to POST json to Asp.net web API server using $http it\'s returning the following error

XMLHttpRequest cannot load http://localhost:6         


        
2条回答
  •  余生分开走
    2020-12-30 09:08

    I think you must set the content-type on your ajax call:

    contentType: 'application/x-www-form-urlencoded; charset=utf-8',
    

    or

    contentType: 'application/json; charset=utf-8',
    

提交回复
热议问题