Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Service | Customer Service, Contact Center, Fie...
Unanswered

querying external JSON api on D365 Portals

(0) ShareShare
ReportReport
Posted on by 1,255

Hello knowledgeable peeps!

Today i'm facing a couple of issues with D365 Portals... i have to display on a portals Page the weather from a open api... easy thing... until i'm getting errors by CORS and CROSS-DOMAIN stuffs...

i've tried adding HTTP/"HEADERS" to Portals Settings... it fixes a couple of things, but still not able to consume the data to display the fakin weather report...

Here the code i'm using to get the data, then i use JS to set it on divs in the requested page:

$.ajax({
		type: 'GET',
		url: 'https://forecast7.com/es/41d392d17/barcelona/?format=json',
		crossDomain: true,
		dataType: 'jsonp',
		success: function(data){
			console.log(data);
		 }
});

here the config i made in Portals Settings

SiteSettings_5F00_Portals.png

Here the error  i'm getting:

"Script from forecast7.com/.../ was blocked due to mime type mismatch"

If i try to set the <script type="application/json"> it does nothing, and if i use it as "type=text/javascript" it does nothing neither.

What could i be missing? or what im doing wrong?

Appreciate any guide or friendly hand,

Thanks in advance!

  • OmarZaarour Profile Picture
    OmarZaarour 1,705 on at
    RE: querying external JSON api on D365 Portals

    hey, try to set the content type in your ajax call along with the datatype as well. Check https://stackoverflow.com/questions/18701282/what-is-content-type-and-datatype-in-an-ajax-request for reference. 

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Daivat Vartak – Community Spotlight

We are honored to recognize Daivat Vartak as our March 2025 Community…

Announcing Our 2025 Season 1 Super Users!

A new season of Super Users has arrived, and we are so grateful for the daily…

Kudos to the February Top 10 Community Stars!

Thanks for all your good work in the Community!

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 292,516 Super User 2025 Season 1

#2
Martin Dráb Profile Picture

Martin Dráb 231,432 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans