1

Can someone explain the use of:

this.collListItem

In this example: enter image description here

When I try use this example I get the following error: enter image description here

I am able to get around this by explicity creating the variable:

var collListItem = whatever...

But the former appears to work for Microsoft. Can someone explain how this works if they aren't creating the variable?

  • I do not think that sample works for anyone, ms included. Those errors has been in it for a long time – Robert Lindgren Sep 29 '16 at 16:02
  • So what's the workaround then? If I wish to keep it as this.collListItem where should I instantiate the variable? – Ray Hogan Sep 29 '16 at 16:04
  • Yep, ran into the same issue with that code. Just remove 'this' – Michael Colbs Sep 29 '16 at 16:16
  • 1
    The problem with this is that it is function scoped, so it is a completely new this in the success method, so either save the this from the first method in a new variable (e.g var _self = this) and then use _self in the success method, or just use the workaround you already have found – Robert Lindgren Sep 29 '16 at 16:38

Your Answer

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

Browse other questions tagged or ask your own question.