Isolate JS code that calls Web API