West Ham have agreed a deal to take Manchester United midfielder Jesse Lingard on loan for the remainder of the season.