javascript - Restangular | CustomPOST : I am unable to make a CORS POST request, with json data object in the body -
i trying make cors post request using restangular in following manner :
//data json object var urltopost = '/api/deal/update/'+dealid; return restangular.all(urltopost).custompost(data, '', {}, { "content-type": "application/json", "access-control-allow-origin": "*", "access-control-allow-methods": "post, get, put, delete, options" });
when hit call, following error appears on console :
xmlhttprequest cannot load http://55.76.122.145:8080/hulk/api/deal/update/55cd93bd20ce9744aeebff3a. no 'access-control-allow-origin' header present on requested resource. origin 'http://localhost:9001' therefore not allowed access.
and in network tab, can see successful
call status 200
being fired option
method.
how go it? doing wrong ?
the error message spells out you:
no 'access-control-allow-origin' header present on requested resource. origin 'http://localhost:9001' therefore not allowed access.
the server must respond option request response including access-control-allow-origin
header tells browser website providing javascript allowed access.
access-control-allow-origin
, access-control-allow-methods
not request headers. can't write javascript gives permission read data other people's websites. silly.
Comments
Post a Comment