I have read this question/answer and this one, but I can't get it to work in my situation.
I'm building a list of names from a json array returned from a php script. After the below code I'm putting the goTosList string into a label via jquery. I need each name to be on a new line.
The below code is just outputting
var goTosList = '';
if (data !== 'empty') {
// Build the go tos list as a comma-separated string
$.each(data, function(index,element) {
goTosList += (element['name'] === undefined ? '' : element['name']) + '\n\r';
});
}
I've tried just \r
and just \n
and without the single quotes. I can't get it to work.