Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Supported by

Inserting javascript code from an external .js file

Hi there,

I'm trying to work out a method to get around the fact that OSWeb does allow loops to use a file as a source.

The initial part of the post relates to HTML but bear with me, I then do get on to my questions about OSweb (and JATOS)...

I'm currently exploring the possibility of using PapaParse (https://www.papaparse.com/) to parse a csv (from a URL) into an array. I've started exploring it using HTML code to host a page on my server. So far I've managed to write javascript code to access a csv file through a URL (hosted on Github to get around the cross-origin resource sharing (CORS) issue), and I've uploaded papaparse.min.js onto my server so that it can be called in using "<script src=... </script>". I've got some way to go still, but I do get the content of the csv into an array.

Here' what the method looks like in HTML:

You can try it out here: https://neurocog.uib.es/testcsv/test4.html (use the console to see the results).

I get this... The content of my csv file (2 headers on first row, then 4 rows with two pieces of string on each row). Sweet...

So far so good (or at least not too bad). One limitation is that Github allows access to csv files but apparently not to .js files (or at least I get a CORS warning message when I tried to specify the source of the .js file as a complete URL to a raw.github address). So, for now I got around this issue by copying the .js file to my server in the same folder as my HTML document.

Now comes the point where I get stuck... implementing it into OS... I'm trying to get OS to load up the papaparse.min.js file but I can't work out the correct path to use... (nor am I totally sure of the method I'm using to call the js file). This is what I'm trying:

I've also tried specifying the script.scr as "papaparse.min.js" (no "./" prefix) and I added papaparse.min.js to the pool file in OS. But to no avail. When running the task in the browser, the program can't find the .js file.

I tried loading up the task to JATOS on my own server (after installing papaparser through npm), but the same thing happens the task can't get to the .js file.

So, in a nutshell, I'm a little lost as how to specify paths and where to store the .js file for my task to find it when running it from my browser (especially through JATOS, as my aim is to use this for running an experiment online).

When trying to run it through JATOS, I get the following error message:

I can't work out where the publix/49/49 folder is located on my server, and I was wondering whether there is a way to have .js resources centrally located and set a path to that location instead of having to copy the .js resource inside every individual experiment folder (which I'm not sure how to do anyway).

Stuck at that stage, I can't really tell yet whether the next bit of the task will run smoothly:

I can't help but feel that calling on papaparse.min.js may be a possible solution to populate loops with data from a csv file, but as you can see, I'm having some issues pointing OS/JATOS to the .js resource. If that could be solved, I think I might then be able to get the content on the csv into an array and then use a modified version of the solution I posted in another thread to use that array as a substitute for the file source method of the loop in OS.

Sorry for the rather long description; just trying to be complete. In a nutshell, my problem is to get OS to read an external .js file (either hosted locally or from a URL, though I suspect the latter is doomed due to CORS). If anybody out there could help me with that bit, that would be awesome!

Best,

Fabrice.

Buy Me A Coffee

Comments

Sign In or Register to comment.

agen judi bola , sportbook, casino, togel, number game, singapore, tangkas, basket, slot, poker, dominoqq, agen bola. Semua permainan bisa dimainkan hanya dengan 1 ID. minimal deposit 50.000 ,- bonus cashback hingga 10% , diskon togel hingga 66% bisa bermain di android dan IOS kapanpun dan dimana pun. poker , bandarq , aduq, domino qq , dominobet. Semua permainan bisa dimainkan hanya dengan 1 ID. minimal deposit 10.000 ,- bonus turnover 0.5% dan bonus referral 20%. Bonus - bonus yang dihadirkan bisa terbilang cukup tinggi dan memuaskan, anda hanya perlu memasang pada situs yang memberikan bursa pasaran terbaik yaitu http://45.77.173.118/ Bola168. Situs penyedia segala jenis permainan poker online kini semakin banyak ditemukan di Internet, salah satunya TahunQQ merupakan situs Agen Judi Domino66 Dan BandarQ Terpercaya yang mampu memberikan banyak provit bagi bettornya. Permainan Yang Di Sediakan Dewi365 Juga sangat banyak Dan menarik dan Peluang untuk memenangkan Taruhan Judi online ini juga sangat mudah . Mainkan Segera Taruhan Sportbook anda bersama Agen Judi Bola Bersama Dewi365 Kemenangan Anda Berapa pun akan Terbayarkan. Tersedia 9 macam permainan seru yang bisa kamu mainkan hanya di dalam 1 ID saja. Permainan seru yang tersedia seperti Poker, Domino QQ Dan juga BandarQ Online. Semuanya tersedia lengkap hanya di ABGQQ. Situs ABGQQ sangat mudah dimenangkan, kamu juga akan mendapatkan mega bonus dan setiap pemain berhak mendapatkan cashback mingguan. ABGQQ juga telah diakui sebagai Bandar Domino Online yang menjamin sistem FAIR PLAY disetiap permainan yang bisa dimainkan dengan deposit minimal hanya Rp.25.000. DEWI365 adalah Bandar Judi Bola Terpercaya & resmi dan terpercaya di indonesia. Situs judi bola ini menyediakan fasilitas bagi anda untuk dapat bermain memainkan permainan judi bola. Didalam situs ini memiliki berbagai permainan taruhan bola terlengkap seperti Sbobet, yang membuat DEWI365 menjadi situs judi bola terbaik dan terpercaya di Indonesia. Tentunya sebagai situs yang bertugas sebagai Bandar Poker Online pastinya akan berusaha untuk menjaga semua informasi dan keamanan yang terdapat di POKERQQ13. Kotakqq adalah situs Judi Poker Online Terpercayayang menyediakan 9 jenis permainan sakong online, dominoqq, domino99, bandarq, bandar ceme, aduq, poker online, bandar poker, balak66, perang baccarat, dan capsa susun. Dengan minimal deposit withdraw 15.000 Anda sudah bisa memainkan semua permaina pkv games di situs kami. Jackpot besar,Win rate tinggi, Fair play, PKV Games