What is the error? Is it something related to CORS?
If yes, are you in control of the endpoint you are calling?
If yes you can add proper handling of CORS in your backend.
If no as a workaround you can add another endpoint on your backend that will proxy the request to the real endpoint and will return the response with the correct handling of CORS.
See also this related topic.