0

While, calling a helper function from inside of window.settimeout, i am getting the error as and function is not getting called

XMLHttpRequest cannot load https://domain.com/_ui/common/request/servlet/JsLoggingServlet. No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'https://domain.com' is therefore not allowed access.

init: function(component,event,helper) {

        var action = component.get("c.apexfunction");
         action.setParams({
             testId: testID
        });
        action.setCallback(this, function(response) {

            window.setTimeout(function() {                      
                helper.testFunction();
                }, 5000
            ); 

        }
},

testFunction : function(){
    alert('testFunction');

}
3

You have to Include $A.enqueueAction(action)

            var action = component.get("c.apexfunction");
             action.setParams({
                 testId: testID
            });
            action.setCallback(this, function(response) {

                window.setTimeout(function() {


                            helper.testFunction();


                            }, 5000
                        ); 

            }); $A.enqueueAction(action);  },
| improve this answer | |
0

Hi guys thanks for your but unfortunately none worked well in my case. But, instead i used rerender which solved my issue.thanks again however for quick responses.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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