function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
UshankUshank 

Not able to call custom rest service from java script.

Hello Guys,

I am trying to call apex rest api from Jquery Ajax functional which is giving me unauthorized "400 error status" in return. I am setting the request header with session information "xhr.setRequestHeader('Authorization', "OAuth " + session);" as this.
When I am trying to call the webservice from Chrome rest console, workbench and Soap UI its working fine and giving me result back but I am only facing issue while trying to call this service from java script.
Could it be because of cross site scripting? 
Please suggest me how to proceed further.
Best Answer chosen by Ushank
UshankUshank
I am able to solve the problem by setting up the proxy servers in the request header.