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

Calling CRM 2015 custom actions using $.ajax

$
0
0

Hello all,

I am getting internal server error 500 when calling custom action in crm 2015 online using $.ajax(post) method . Though it works fine with XMLHttpRequest. Is there anything which i am missing? below is the ajax code i am calling.

Requestmain is the variable which contains the soap xml.

$.ajax({
type: "POST",
contentType: "application/json; charset=utf-8",
SOAPAction: "schemas.microsoft.com/.../Execute",
datatype: "json",
url: Xrm.Page.context.getClientUrl() + "/XRMServices/2011/OrganizationData.svc/AccountSet",
data: requestmain,
beforeSend: function (XMLHttpRequest) {
//Specifying this header ensures that the results will be returned as JSON.
XMLHttpRequest.setRequestHeader("Accept", "application/json");
},
success: function (data, textStatus, XmlHttpRequest) {
account = data.d;
},
error: function (XMLHttpRequest, textStatus, errorThrown) {
errorHandler(XMLHttpRequest, textStatus, errorThrown);
}
});

Thanks
Uday


Viewing all articles
Browse latest Browse all 82002

Latest Images

Trending Articles



Latest Images