I have a Sharepoint 2013 application that has multiple (3) ExecuteQueryAsync calls in 3 different functions.

Two of them are referring to the Project Server project context, and one is referring to the Sharepoint client context.

I managed to nest the two querys that are used with the project context, and they are working together without any problems.

The problem is, that before this could happen, I need to access a remote domain for some information and I have a crossDomainCall.

This crossDomainCall has an ExecuteQueryAsync to the Sharepoint Client Context,

It goes through it, but if I want to run the other two querys after that, those will give back this error message : Unexpected response from server. The status code of response is '404'. The status text of response is 'Not found'.

This is the crossDomainCall

sampleclass.prototype.crossDomainCall = function (SPHostUrl, callUrl, successCallback, failureCallback) {

    $.getScript(SPHostUrl + "/_layouts/15/" + "SP.RequestExecutor.js", Function.createDelegate(this, function () {

    // First construct our JSOM request
    var clientContext = new SP.ClientContext.get_current();

    var crossDomainRequest = new SP.WebRequestInfo();

    var response = SP.WebProxy.invoke(clientContext, crossDomainRequest);

    // Execute our request with a callback function
    clientContext.executeQueryAsync(Function.createDelegate(this, function () {
        var statusCode = response.get_statusCode();

        // HTTP status success / failure determines which callback function to send our results to
        if (statusCode === 200) {
            // JavaScript functions are first-class objects (how cool!)
        else {
            failureCallback(statusCode, response.get_body());

It feels to me, that the second and third Async querys are not able to get the correct URL, after this one goes through.

1 Answer 1


Ok, got it to work! I used project context for every ExecuteQueryAsync so there's no mixup now.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.