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

cross-domain Ajax POST inside webresource

$
0
0

Hi all,

I've a requirement that to call external service with AJAX POST method. This service supports CORS and working correctly from any webpage, however I get exception (Access Denied) when I try to post data inside Dynamics 365 online webresource file.

Just simple code is below;

var request = {

"Data": "My parameter",
    "Validation": "My validation"
};


$.ajax({
    url: _myExternalServiceUrl,
    async: true,
    type: 'POST',
    data: JSON.stringify(request),
    contentType: "application/json; charset=utf-8",
    crossDomain: true,
    dataType: 'json',
    beforeSend: function (xhr) {
        $("#loadingbar").show();
    },
    complete: function () {
        $("#loadingbar").hide();
    },
    success: function (response) {
        console.log(JSON.stringify(response));
    },
    error: function (xhr, ajaxOptions, thrownError) {
        alert("exception : " + xhr.statusText);
    }
});

I think maybe it's about "POST" to cross domain, because JSONP and GET method allows crossdomain calls.

Do you have any idea, suggestion for this?

Kind regards


Viewing all articles
Browse latest Browse all 55831

Trending Articles