Optimized javascript for ajax push.