"error in server response" case leads to multiple cb calls

either the setTimeout api_call redo gets removed or the callback.call part needs to be moved up into the else part. The way its currently handled in the "error in server response" redoes the api call which will execute the callback method and its called anyway later.