Cryptocurrency API help

Hi,

I am using a cryptocurrency API price tracker from: https://www.dunebook.com/create-a-cryptocurrency-price-update-website-using-wix-code/ .

This current code allows me to pull the top 10 cryptocurrency prices from CoinMarketCap:

export function page1_viewportEnter(event, $w) {
getTopCoins().then(response => {
$w('#coinList').text = "Name: " + response[0].name + "t t"
+ "Symbol: " + response[0].symbol + "t t"
+ "Price (USD): " + response[0].price_usd + "n n"
+ "Name: " + response[1].name + "t t"
+ "Symbol: " + response[1].symbol + "t t"
+ "Price (USD): " + response[1].price_usd + "n n"
+ "Name: " + response[2].name + "t t"
+ "Symbol: " + response[2].symbol + "t t"
+ "Price (USD): " + response[2].price_usd + "n n"
+ "Name: " + response[3].name + "t t"
+ "Symbol: " + response[3].symbol + "t t"
+ "Price (USD): " + response[3].price_usd + "n n"
+ "Name: " + response[4].name + "t t"
+ "Symbol: " + response[4].symbol + "t t"
+ "Price (USD): " + response[4].price_usd + "n n"
+ "Name: " + response[5].name + "t t"
+ "Symbol: " + response[5].symbol + "t t"
+ "Price (USD): " + response[5].price_usd + "n n"
+ "Name: " + response[6].name + "t t"
+ "Symbol: " + response[6].symbol + "t t"
+ "Price (USD): " + response[6].price_usd + "n n"
+ "Name: " + response[7].name + "t t"
+ "Symbol: " + response[7].symbol + "t t"
+ "Price (USD): " + response[7].price_usd + "n n"
+ "Name: " + response[8].name + "t t"
+ "Symbol: " + response[8].symbol + "t t"
+ "Price (USD): " + response[8].price_usd + "n n"
+ "Name: " + response[9].name + "t t"
+ "Symbol: " + response[9].symbol + "t t"
+ "Price (USD): " + response[9].price_usd + "n n"
});
}

Apparently, the “n n” is supposed to create the new line, but this is the current output:


This is how it should look:

Does anyone have any idea on how I can separate the lines like shown in the above screenshot?

This is the link to my wix page:
https://twistingknobs8.wixsite.com/mysite

Let me know if I am missing any information and I am willing to jump on a audio/video call for a further deep dive!

Thanks,
Robert

I would suggest that you go back and read the page carefully and recheck the example pics of any code used on this example.

As the code on this page screenshot looks different to what is in the text file below you have copied from.

The copy and paste text doesn’t match up:

export function page1_viewportEnter(event, $w) {

getTopCoins().then(response => {
$w('#coinList').text = "Name: " + response[0].name + "t t"
+ "Symbol: " + response[0].symbol + "t t"
//and so on with the code.....
1 Like

Yeah, I think he made some errors when posting that code. For example, the export function should be “coinList_viewportEnter…”, not “page1_viewportEnter…”. Also, in his screenshot his then function contains “” in the response[0] line, but when he displays his code to copy and paste, it is missing the , but I don’t think this solves my issue of creating a new line.

bump