Can you tell me why this works:
PageMethods.UpdateForcedDisposition(forcedDisposition, a.value, SucceededCallback, FailedCallback);
When this doesn’t?
setTimeout("PageMethods.UpdateForcedDisposition(" + forcedDisposition + "," + a.value + ", SucceededCallback, FailedCallback);", 1000);
Interestingly, a similar call works with setTimeout:
setTimeout("PageMethods.UpdateSales(" + id + ", " + a.value + ", SucceededCallback, FailedCallback);", 1000);
…I’m stumped!
Avoid passing a string to
setTimeout. Where possible, use anonymous functions:A
setTimeoutwith a string executes in the global scope. If you’re trying to reference variables from the current scope, you’ll hit an error.