refactored
jquery for setting amount
function for buying