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');

}
1

2 Answers 2

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);  },
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.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .