change to ajax calls & added another endpt to send