Open Closed

How do I consume external Rest API from ABP Commercial? #947


User avatar
0
datarebel created

I normally consume jquery API like below, however CORS is preventing this from executing outside of my application domain. How do I enable CORS for other domains?

I get this error: Cross-Origin Request Blocked: The Same Origin Policy disallows reading the remote resource at .....

`var settings = { 'cache': false, 'dataType': "json", "async": true, "crossDomain": true, "url": "https://

$.ajax(settings).done(function (response) {
    console.log(response);

});`

2 Answer(s)
  • User Avatar
    0
    alper created
    Support Team Director

    you can use abp.ajax for ajax calls. https://docs.abp.io/en/abp/latest/UI/AspNetCore/JavaScript-API/Ajax#basic-usage

    on the other hand if you are getting error from your 3rd party API, you should add your client to that server's granted clients.

  • User Avatar
    0
    datarebel created

    Thanks for the response. Is there any way to disable CORS globally or on a per pagemodel view for development testing sake?

    Cheers, Sheldon.

Boost Your Development
ABP Live Training
Packages
See Trainings
Mastering ABP Framework Book
Do you need assistance from an ABP expert?
Schedule a Meeting
Mastering ABP Framework Book
The Official Guide
Mastering
ABP Framework
Learn More
Mastering ABP Framework Book
Made with ❤️ on ABP v9.3.0-preview. Updated on May 12, 2025, 05:22