Reputation: 10571
I tried:
val['*'].replace(/,/g , '')
But i still have the comma
,Битва при реке Пэккан
,Bitka kod Baekganga
,Битва при річці Пек
,Trận Bạch Giang
,白江口之战
UPDATE
data.parse.langlinks.map(function(val){
return val['*']
});
Upvotes: 0
Views: 76
Reputation: 15711
From what I've finally been able to grab, you are using this kind of line (stripped a bit)
$('#results').append('<li>' + curTitle + "<br>" + data.parse.langlinks.map(function(val){ return val['*'] + "<br>" }) + '</li>');
What happens is that the result from data.parse.langlinks.map is an array, and to concatenate that to the
You can see by yourself using this:
console.log(data.parse.langlinks.map(function(val){ return val['*'] + "<br>" }).toString());
To fix this, you have multiple possibilities, the best is to leverage jQuery's flexible append this way:
$('#results').append('<li>' , curTitle , "<br>" , data.parse.langlinks.map(function(val){ return val['*'] + "<br>" }) , '</li>');
The good thing about append is that it takes unlimited amount of parameters, just as if you called it once for every param. And it also accepts array, and handle them correctly.
Upvotes: 1