javascript put callback working