Why does a cross-domain angularjs $http.post request fail when a XMLHttpRequest succeeds?

前端 未结 6 410
情歌与酒
情歌与酒 2021-02-01 10:32

I am trying to exercise the Trello API with an application key and token from an angular (version 1.0.5) webapp. The server seems correctly configured to handle CORS. A test req

6条回答
  •  失恋的感觉
    2021-02-01 11:35

    This worked for me

    $http({
          method  : "POST",
          url     : url,
          data    : $.param({key: 'value', key2 : 'value'}),
          headers : { 'Content-Type': 'application/x-www-form-urlencoded; charset=UTF-8' }
                    })
    

提交回复
热议问题