West Ham have agreed a deal to sign Jesse Lingard on loan from Manchester United until the end of the season.