Quantcast
Channel: Microsoft Dynamics CRM Forum - Recent Threads
Viewing all articles
Browse latest Browse all 46379

CRM 365 Portals-No 'Access-Control-Allow-Origin' header is present on the requested resource.

$
0
0

Hi,

I am trying to update a record from CRM 365 portals on a custom Button Click "Search" using Jquery Odata call. I am getting following error :

"XMLHttpRequest cannot load xyz.crm.dynamics.com/.../ylwf_xyzentitySet(guid'ce2e2bc9-5dd3-e611-9400-0003ff813809'). Response to preflight request doesn't pass access control check: No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'xyz.microsoftcrmportals.com' is therefore not allowed access. The response had HTTP status code 400."

Please help me how to resolve this. 

Please find below code :

$(document).ready(function () {
$(".deactivate-link btn-default btn").click(function (event) {
alert(event.isDefaultPrevented()); event.preventDefault(); alert(event.isDefaultPrevented()); alert('success');
}); $("#custom").click(function () {
alert("Hello"); $.support.cors = true; var entity = {};
entity.ylwf_lfe_SendEmails = true;

$.ajax({
type: "POST",
crossDomain: true,
contentType: "application/json; charset=utf-8",
datatype: "json",
url: "xyz.crm.dynamics.com/.../ylwf_xyzentitySet(guid'ce2e2bc9-5dd3-e611-9400-0003ff813809')",
data: JSON.stringify(entity),
beforeSend: function (XMLHttpRequest) {
XMLHttpRequest.setRequestHeader("Accept", "application/json");
XMLHttpRequest.setRequestHeader("X-HTTP-Method", "MERGE");
},
async: true,
success: function (data, textStatus, xhr) {
//Success - No Return Data - Do Something
},
error: function (xhr, textStatus, errorThrown) {
alert(textStatus + " " + errorThrown);
}
});
});
});


Viewing all articles
Browse latest Browse all 46379

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>