added bet and ajax function