top of page

Forum Posts

lucas_marconi
Aug 22, 2018
In Coding with Velo
Hi all, I have a repeater whose data are from a JSON. The data successfully loaded into the repeater but the repeater only shows two items. I have more than two items from JSON. How can I set the repeater to show all of items. Or better yet, implement a pagination to my repeater using next/prev button. I know how to implement pagination if the repeater is linked to a Dataset but in my case, the repeater is not linked to a dataset. Thanks in advance.
0
1
204
lucas_marconi
Aug 20, 2018
In Coding with Velo
Hi all! I have a problem accessing an API shared by iTunes. The API is to get an RSS feed and/or search items in iTunes. To access iTunes, I need to parse a query through a URL and expect response in json format. When the URL is parsed in Preview Mode, the "fetch" is successfully carried out and I get the response in json format. However if i parse it in Published sited using wix-fetch, i get an error shown below: "Failed to load https://itunes.apple.com/search?term=jack+johnson: The 'Access-Control- Allow-Origin' header has a value 'https://ee8f2056-10ec-4e93-a41c-88a538e70b77.dev.wix- code.com' that is not equal to the supplied origin. Origin 'https://lucas-marconi.wixsite.com' is therefore not allowed access. Have the server send the header with a valid value, or, if an opaque response serves your needs, set the request's mode to 'no-cors' to fetch the resource with CORS disabled." /**** here is my code ****/ import {fetch} from 'wix-fetch'; fetch("https://itunes.apple.com/search?term=jack+johnson", { method: "get", headers: { "Access-Control-Allow-Origin": "*", "Content-Type": "application/json" } }) .then( (httpResponse) => { let url = httpResponse.url; let statusCode = httpResponse.status; let statusText = httpResponse.statusText; let headers = httpResponse.headers; let bodyUsed = httpResponse.bodyUsed; if (httpResponse.ok) { return httpResponse.json(); } else { return Promise.reject("Fetch did not succeed"); } }) .then( (json) => { /******* in preview mode, below line gets executed *******/ console.log(JSON.stringify(json)); }) .catch( (err) => { console.log(err); }); Can anybody shed some light. Thank you in advance!
1
9
5k
lucas_marconi
Jul 22, 2018
In Coding with Velo
I am new to Wix and I am just in the verge of learning using its APIs. I want to open and send data to a Lightbox with the codes below: import wixWindow from 'wix-window'; $w.onReady(function () { $w("#button2").onClick( (event, $w) => { let strAppleMusicPreviewUrl= $w('#dataset1').getCurrentItem().appleMusicPreviewUrl; console.log(strAppleMusicPreviewUrl); wixWindow.openLightbox("SongPreview", strAppleMusicPreviewUrl); } ); }); The code works perfectly in Preview mode but it does work in the Published site. Any idea how to make it work? Thanks, Marconi
0
7
619

lucas_marconi

More actions
bottom of page