Hi Sudeep
Is the JavaScript hosted from the same port as the Gateway services?
For two resources to be considered to have the same origin, the protocols (http/https), the domain and the port (eg 80XX) have to be identical.
eg http://<GW server host>:<GW server port>/<js resources>
hth
John P