Resolving “Access is denied” error in Microsoft CRM 2011 JavaScript web resource

We can get the “Access is denied” error, while making to a web service, if the service is hosted in the other domain (Cross Domain). We faced this issue while calling one of the services using jQuery. To resolve this we need to set the “$.support.cors” property to true as shown below.


var serviceUrl = <service url>;
 $.support.cors = true;
 $.ajax({
 type: "GET",
 url: serviceUrl,
 cache: false,
 data: null,
 contentType: "application/json; charset=utf-8",
 dataType: "json",
 success: function (response) {
 //Code logic to process service response.
 },
 error: function (e) {
 alert('request failed');
 //Code logic to handle error.
 }
 });

Hope it helps!

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s