javascript - AngularJS Cross-Domain POST request blocked by CORS -
i working on app uses api different domain have no command on it's header.
the api allows post it's api passing username , key in url. method needs post , code this.
$http({ url : url, method : "post", headers : { 'content-type' : 'application/json' }, info : { name: "joe", number: 1234567890 } }).success(function(data) { //do });
the info beingness posted beingness pass object above.
i'm new cors have conceptual idea. 1 time again have access api. instructions need send post request , pass in header of content type 'content-type' : 'application/json'
any help welcomed, have looked @ post alter angular's settings in config method
$httpprovider.defaults.withcredentials = true; $httpprovider.defaults.usexdomain = true; delete $httpprovider.defaults.headers.common['x-requested-with'];
but doesn't anything. believe prepare older version of angular. other solutions require access server don't have. header response looks this
allow get,put,post,patch,head,options content-encoding gzip content-type text/html; charset=utf-8 date wed, 15 oct 2014 06:42:43 gmt p3p policyref="https://www.somedomaincom/w3c/p3p.xml", cp="non dsp cor cura adma deva psaa psda ivaa ivda cona tela our stp phy onl com nav int dem cnt pre" server nginx/1.1.19 transfer-encoding chunked vary host, cookie
javascript angularjs cors
No comments:
Post a Comment