Error, Microsoft Ajax : unable to get property apply of undefined 

I was stuck in this error while working with JavaScript Ajax calls.

Basically when Ajax call is given, next line of code gets executed irrespective of response. It doesn’t wait for a return value. Hence after completion of execution, when it returns a value, it can’t recognise where to return and throws this error.

To resolve this, make Ajax call as –

var callback = clientcontext.executeQueryAsync(Function.createDelegate(this, function () { _returnParam = onSuccessFunction(); }), Function.createDelegate(this, function () { _returnParam = onFailedFunction(); }));

This worked for me!

Leave a Comment

Your email address will not be published. Required fields are marked *

Scroll to Top