In the following code some concatenation is needed to put all the lines into PlayersDetail variable so that a div named PlayersList can be appended.
var onlineStatus="online";
PlayersDetail='Here is some text before if statement.<br>'
if (onlineStatus==="online"){
'I am online.<br>'
}
'here is some text after if statement.'
$("#PlayersList").append(PlayersDetail);