How to apply HTML Table in React Native?

What I want is setting all the cells width in a column as widest cell in the column.

For example I have a column and there are cells in that column. Cells have widths by their contents like; 30px, 40px, 30px, 50px, 25px. And I want all the columns width as 50px.

There is no display: table in React Native. There are just flex and none. HTML Tables do this process automatically. I tried to set widths after onLayout event is invoked. But this approach seems slow to me. I am trying to find another solution.

How to achieve this in React Native?

How to solve missing CORS headers when user defined headers provided?

Having troubles with providing Authorization header for requests:

const response = await fetch(url, {
        method: 'GET',
    });

This works properly, and request headers are:

Accept: */*
Accept-Encoding: gzip, deflate, br
Accept-Language: ru-RU,ru;q=0.9,en-US;q=0.8,en;q=0.7
Connection: keep-alive
DNT: 1
Host: localhost:8080
Origin: http://localhost:3000
Referer: http://localhost:3000/
sec-ch-ua: " Not A;Brand";v="99", "Chromium";v="100", "Google Chrome";v="100"
sec-ch-ua-mobile: ?0
sec-ch-ua-platform: "Windows"
Sec-Fetch-Dest: empty
Sec-Fetch-Mode: cors
Sec-Fetch-Site: same-site
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/100.0.4896.127 Safari/537.36

Now if I want to make request with Authorization header in it like:

const response = await fetch(url, {
        method: 'GET',
        headers: {
            "Authorization": `Bearer ${tokenId}`,
        },
    });

Chrome network debug shows that I get problem with CORS.
And google debug shows my request headers:

Authorization: Bearer token
DNT: 1
Referer: http://localhost:3000/
sec-ch-ua: " Not A;Brand";v="99", "Chromium";v="100", "Google Chrome";v="100"
sec-ch-ua-mobile: ?0
sec-ch-ua-platform: "Windows"
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/100.0.4896.127 Safari/537.36

Missing these headers:

Host: localhost:8080
Origin: http://localhost:3000
Sec-Fetch-Dest: empty
Sec-Fetch-Mode: cors
Sec-Fetch-Site: same-site

How should I do my requests with Authorization header? Or should I use other solutions, or fetch has some options to fix that ?

P.S. My server has cors support. Providing Authorization token in headers clear off all cors headers.
Also tried axios for that and had same problem – cors headers missing, but Authorization header provided.

Toggle accordion with checkbox not working as expected

I have an accordion who have a lot of childrens. When you check a continent you got a list of countries. You can have a lot of countries in a continent so, in template, I cut the tree at 9 and give specific classes (.child and .hidden) to hide the rest of countries. You can see this in the code.

      <div role="track-rdb-check" data-name="{{ country.title }}" class="checkbox {% if loop.index > 9 %}hidden child{% endif %}" data-parent-id="{{ continent.id }}"{% if filters and not filters.hasArea(country.parent.id) %} style="display: none;"{% endif %}>
        <input id="destination{{ country.id }}" type="checkbox" name="flexibility_filters[destinations][]" value="{{ country.id }}"{% if filters and filters.hasArea(country.id) %} checked="checked"{% endif %}>
        <label class="labelDestination" for="destination{{ country.id }}">
          <span class="titleDestination">{{ country.title }}</span>
        </label>
      </div> 

The problem is my toggle of countries, after 9 elements, isnt working well because i did it with .child. And there is others countries, in other continent who have the .child class as well.

Here is my js on my “show all” button who have to toggle.

    $(function() {
  var $body = $('body');
  var $destinations = $('#fDestinations');
  var $rdbDestinationChildrenHidden = $('.rdbDestinationsChildren .child');

  $body.on('click', '#destSeeAll', function (e) {
    e.preventDefault();
    $('#show').css('display','block');
    if ($rdbDestinationChildrenHidden.hasClass('hidden')) {
      $rdbDestinationChildrenHidden.removeClass('hidden').addClass('visible').toggle();
    }else if ($rdbDestinationChildrenHidden.hasClass('visible')) {
      $rdbDestinationChildrenHidden.removeClass('visible').addClass('hidden').toggle(); 
    }
  });

Do you have any idea of how can I did the toggle without toggle others countries in other continent ?
I know that my question isnt easy but if you got a way to put me on I’ll be so glad !

Writing an array to a file in javascript

I have an array of 32 strings called “arr” and I’m trying to save it to a file (like a txt file). I’m doing this in javascript because I’m getting this array from an html page.

I’ve tried this solution :
node.js – how to write an array to file

So this code :

var fs = require('fs');

var file = fs.createWriteStream('array.txt');
file.on('error', function(err) { /* error handling */ });
arr.forEach(function(v) { file.write(v.join(', ') + 'n'); });
file.end();

results for me this error :

Error: Module name “fs” has not been loaded yet for context: _. Use
require([])

I saw a solution there : https://requirejs.org/docs/errors.html#scripterror and tried this one :

require(['foo'], function (foo) {
    //foo is now loaded.
});

but it still results 3 errors :

  • “Failed to load resource: the server responded with a status of 404 (Not Found)”
  • “Refused to execute http://[…]/scripts/fs.js as script because “X-Content-Type-Options: nosniff” was given and its Content-Type is not a script MIME type. defaultOnError — require.js:5:1663″
  • “Error: Script error for “fs””

I’m a beginner in Javascript and I don’t really understand how to use require.js.
I tried to find a solution but I everything resulted to those errors.

Could you help me to write arrays in a text file ?
Thank you for your help !

Change getusermedia stream resolution after it is already created

I have a React app that records the user’s webcam I’m implementing a feature to allow the user to change the video resolution. When I create the Media Stream for the first time passing a default video’s width and height it works fine, however when I change the resolution nothing happens I’m still able to record the webcam but the resolution does not change. The following code is used to get the Media Stream, the width and height variables could be 1280x720 or 640x360. The default value mentioned above is 1280x720 and I can’t change it to 640x360 after I the stream is created, if I create the stream using the 640x360 it works though.

const stream = await navigator.mediaDevices.getUserMedia({
        video: {
          width: {
            ideal: width
          },
          height: {
            ideal: height
          },
          frameRate: 25,
          deviceId: { exact: videoInputId || cameraDeviceId },
          aspectRatio: {
            exact: width / height,
          },
        },
        audio: audio,
});
cameraVideoRef.current.srcObject = stream;
setCameraStream(stream);

Is there JS snipet which can place hashed email into website head for user tracking purpose?

I have clients email list with thousands of double opt-in clients in hashed format as well. Now I need to place with “on click” or “window load” event that hashed email (from newsletter for example) to head of website.

My idea is to place short JS code into head section of website, for example:

<script>
window.FnHashEmail = '{email sha hash here}';
</script>

But need help with following – is there any way how to send just exact email hash from database for exact email user when he visits website. I understand logic behid this, but can not assemble approach through code to execute this.

Logic behind: User clicks on link in newsletter, I already have SHA-1 email hash, when he clicks on link, by automation that hash is parsed and placed in the head of website. I know Google do this, Facebook too, but is it possible this to be done without any “big system” development?

What’s the error “Objects are not valid as a React child (found: object with keys {_id, name, img, des, price, quantity, sName}).”

I don’t understand why this error is coming. I can’t find fault in the code, Please tell me why the error is coming?

const Book = ({ book }) => {
    const navigate = useNavigate()
    const { _id, name, des, price, quantity, img, sName } = book;
    return (
        <div className='bg-white rounded-xl p-5'>
            <div className='p-5'>
                <img className='rounded-xl hover:shadow-2xl hover:shadow-black transition ease-in- 
                     out  hover:scale-110  duration-700' src={img} alt="" />
            </div>

            <h4 className='text-xl text-red-400 font-serif my-5'>{name}</h4>
            <h6 className='text-red-400 text-xl font-serif py-3'>Price : ${price}</h6>
            <h6 className=' flex justify-between px-5 font-semibold text-gray-500 font-serif'>
                <span className=''>Stock in : {quantity}</span>
                <span>Supply by {sName}</span>
            </h6>
        </div>

correctly create object with data

I have a loop where i iterate over the pixel data received from the method getImageData().
There I find the coordinates for each pixel (coordX and coordY). Then I filter the pixels depending on the color and I want to push the pixels I need into the object in the following way:

result.coords[coordX][coordY].counted

If with numbers, then like this:

result.coords = {
                    1: {
                        1: {
                            counted: false,
                        },
                        2: {
                            counted: false,
                        },
                    },
                    2: {
                        5: {
                            counted: false,
                        },
                        8: {
                            counted: false,
                        },
                        9: {
                            counted: false,
                        },
                    },
                }

I did this but there are problems:

var result = {
        'coords': {},
    },
    pixel = new app.Color(),
    array = {},
    coordX,
    coordY,
    i;

for (i = 0; options.imageData && i < options.imageData.data.length; i += 4) {
    pixel.x = options.imageData.data[i];
    pixel.y = options.imageData.data[i + 1];
    pixel.z = options.imageData.data[i + 2];
    pixel.a = options.imageData.data[i + 3];
    coordX = (i / 4) % options.imageData.width;
    coordY = Math.floor((i / 4) / options.imageData.width);

    // Pixel filter by color
    if (pixel.x == 255 && pixel.a == 255) {

        array[coordY] = {
            counted: false,
        };

        result.coords[coordX] = array;
        // .. next is the code that is not important ..    
    }
}

Problem of the following type: when I push a new Y coordinate, it is added to the array for all X. But I may have cases when, for example, the Y=5 coordinate will not be at the X=1 coordinate, but only at X=2 (as in example above). But in my case Y=5 will also be added to X=1.

Please tell me how to correctly create an object with property ‘coords’, in which there will be properties X, in which all Y related to it will be stored, in which there will also be property ‘counted’ with value False.

How can I re-distribute values within a charts.js pie chart when a legend item is turned off/on?

I have distributed the data across the pie to equal 100% in total ( I think lol ) please verify that’s correct if you don’t mind. But I want to be able to re-distribute the data when I turn off/on the legend items.

Here’s a sample of the Component

import React from "react";
import { Chart as ChartJS, ArcElement, Tooltip, Legend } from "chart.js";
import { Pie } from "react-chartjs-2";
import ChartDataLabels from "chartjs-plugin-datalabels";

ChartJS.register(ChartDataLabels, ArcElement, Tooltip, Legend);

export const data = [
  { lifetime_viewing_subs: 11497117, name: "US" },
  { lifetime_viewing_subs: 3777651, name: "LATAM" },
  { lifetime_viewing_subs: 2494138, name: "EMEA" }
];

const lifetime_viewing_subs_total = data.map(item => item.lifetime_viewing_subs).reduce((prev, next) => prev + next);

export const pieoptions = {
  responsive: true,
  plugins: {
    legend: {
      position: "bottom",
      align: "center"
    },
    datalabels: {
      color: function (context) {
        return context.dataset.borderColor;
      },
      anchor: "center",
      backgroundColor: function (context) {
        return context.dataset.background;
      },
      borderRadius: 100,
      borderWidth: 2,
      borderColor: function (context) {
        return context.dataset.borderColor;
      },
      display: function (context) {
        var dataset = context.dataset;
        var value = dataset.data[context.dataIndex];
        console.log("context.dataIndex: ", context.dataIndex); // 0,1,2
        console.log("dataset: ", dataset); // the dataset object
        console.log("value: ", value); // 0.1403653100534158, 0.647035726341284, 0.21259896360530017
      
        return value;
      },
      formatter: function (value) {
        return Math.round(value * 100).toFixed(0) + "%";
      },
      font: {
        weight: 500,
        size: "14rem"
      }
    }
  }
};

export const piedata = {
  labels: data.map((s) => s.name),
  datasets: [
    {
      data: data.map((s) => s.lifetime_viewing_subs/lifetime_viewing_subs_total),
      backgroundColor: [
        "rgba(255, 99, 132, 0.2)",
        "rgba(54, 162, 235, 0.2)",
        "rgba(255, 206, 86, 0.2)"
      ],
      borderColor: [
        "rgba(255, 99, 132, 1)",
        "rgba(54, 162, 235, 1)",
        "rgba(255, 206, 86, 1)"
      ],
      fill: true,
      borderWidth: 1
    }
  ]
};

export function App() {
  return (
    <Pie options={pieoptions} plugins={[ChartDataLabels]} data={piedata} />
  );
}

Here is a playground

Thanks in advance

Text and images not coming through correctly for VUE 2 Javascript

I have been trying to get the text and images to display correctly on my Netflix app, I am using VUE.js 3 to achieve this, however, there is something wrong with my code that is causing issues that are preventing the images and text from displaying correctly, and I am not sure what is causing the issue

I am using the comedy function only to test and see if something comes through.

outcome: Want images and text to display as you see on Netflix

import { movie } from "../js/Movie.js";

const USER_SIGNED_IN_KEY = "sign-in-user-storage-key";
const WATCHLIST_KEY = "watchlist-storage key";

Vue.createApp({
  data(){
    return{
      movies:[
        new movie("#6507", 
        "The Adam Project", 
        "Sci-Fi", 
        "false", 
        "106 minutes",
        "9 March 2022", 
        "https://occ-0-1254-34.1.nflxso.net/dnm/api/v6/9pS1daC2n6UGc3dUogvWIPMR_OU/AAAABQr8Qa4KG69tj9KcwskjJq9rAovupDtcPVlcu1T1aHKxXQqP98t3YNL4NYNN-Ll0eqQh8dFdaAtaGYD6Qj-_0x36cnUXstpp6-y5jRdaSXkmCDASTDlpZz1hBg.webp?r=6ef"),
        
        new movie("#7770", 
        "Here Comes The Boom", 
        "Comedy",
        "false",
        "105 minutes",
        "12 October 2012", 
        "https://occ-0-1254-34.1.nflxso.net/dnm/api/v6/9pS1daC2n6UGc3dUogvWIPMR_OU/AAAABazQ4Z5r1lg_fwOK_h2pWt_86Xtup4p7_Zz_a-V-xS1m9okvm1yMqjO1Yk5hDvQOLeAT3aUJkVYm55V9nvlNCt5I_hd4ICgtOadhUs31b-AK5gMSscBFB4COow.webp?r=657"),
        
        new movie("#2385", 
        "IZombie", 
        "Crime",
        "false",
        "42 minutes",
        "17 March 2015", 
        "https://occ-0-1254-34.1.nflxso.net/dnm/api/v6/X194eJsgWBDE2aQbaNdmCXGUP-Y/AAAABen4hrWdW8EPoWoGmgQZyXKe0LkHSS5s3_EWpdbkugkIze06dsgFELnnW8fe6eq23UEIjsQsfjzGhA0epNzbpCZLHurJ9Tw48y4_.webp?r=c0e"),

        new movie("#2892", 
        "The Witcher", 
        "Fantasy",
        "false",
        "47-67 minutes", 
        "20 December 2019", 
        "https://occ-0-1254-34.1.nflxso.net/dnm/api/v6/9pS1daC2n6UGc3dUogvWIPMR_OU/AAAABSzFqrewVma8qubSm2ufZ5Y8-Q8s32hhyv7zOLJZIbqp_0FwjVn0kE1ZvNxJfk3hmTPqgz_4C9d48OIXS9FNiZ-COLqm9edtB8dFgcijpFjJn5w4T6mfmY8yNg.webp?r=6a6"),

        new movie("#8679", 
        "The Fighter", 
        "Drama", 
        "false", 
        "116 minutes",
        "25 February 2011", 
        "https://occ-0-1254-34.1.nflxso.net/dnm/api/v6/E8vDc_W8CLv7-yMQu8KMEC7Rrr8/AAAABdOBQIok_7x8t8a2XGbRkjMGRcKjpMArjfho0Fo3uL8MQn_7vG9l-IrA4_Fe7HN1tWRTWwAqNMl9BG3l_20GSdXPAL-gxv0cJ8Uk.webp?r=53e"),

        new movie("#7859",
        "Jackass 3.5",
        "Comedy",
        "false",
        "84 minutes",
        "14 June 2011",
        "https://occ-0-1254-34.1.nflxso.net/dnm/api/v6/E8vDc_W8CLv7-yMQu8KMEC7Rrr8/AAAABZ2iBUWD19pSI3OASFvafY-rKoS7CcLNuY-sfep5JHKFAfRYcV-GoKUTuJMCk7h57UagK-LNDF_25OShrmAaRUfJw_RJwPJy6zSk.webp?r=88c")
      ],

      users: [],
      username:"",
      comingSoon:[],
      showByIndex:null,
    };
  },

  computed:{
    moviesComingsoon(){
      return this.movies.filter((movie) => {
        return !movie.comingSoon;
      });
    },

    availMovies(){
      return this.movies.filter((movie) =>{
        return !movie.comingSoon;
      });
    },
  },

  comedy(){
    return this.movies.filter((movie) =>{
      return movie.genre === "comedy" && !movie.comingSoon;
    });
  },

  crime(){
    return this.movies.filter((movie) =>{
      return movie.genre === "Crime" && !movie.comingSoon;
    });
  },

  drama(){
    return this.movies.filter((movie) =>{
      return movie.genre === "Drama" && !movie.comingSoon;
    });
  },

  fantasy(){
    return this.movies.filter((movie) =>{
      return movie.genre === "Fantasy" && !movie.comingSoon;
    });
  },

  
  methods:{
    watchList(index){
      if(!localStorage.getItem(WATCHLIST_KEY)){
        let watchList=[];
        watchList.push(this.availMovies[index]);
        localStorage.setItem(WATCHLIST_KEY, JSON.stringify(watchList));
      }
      else{
        let watchList = JSON.parse(localStorage.getItem(WATCHLIST_KEY));

        watchList.push(this.availMovies[index]);
        localStorage.setItem(WATCHLIST_KEY, JSON.stringify(watchList));
    }
  },
},

  watchList(){
    window.location.href = "../pages/watchList.html";
  },

  logout(){
    localStorage.removeItem(USER_SIGNED_IN_KEY);
    window.location.href = ".../../index.html";
  },


  mounted(){
    this.users = JSON.parse(localStorage.getItem(USER_SIGNED_IN_KEY))
    this.username = this.users[0]._username
  },
})

.mount("#netflixapp");
<!DOCTYPE html>
<html lang="en">
​
<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <link href="https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.min.css" rel="stylesheet"
    integrity="sha384-1BmE4kWBq78iYhFldvKuhfTAU6auU8tT94WrHftjDbrCEXSU1oBoqyl2QvZ6jIW3" crossorigin="anonymous">
  <link rel="stylesheet" href="/css/home.css">
  <script src="https://unpkg.com/vue@3" defer></script>
  <script src="../js/home.js" type="module" defer></script>
  <script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/js/bootstrap.bundle.min.js"
    integrity="sha384-ka7Sk0Gln4gmtz2MlQnikT1wXgYsOg+OMhuP+IlRH9sENBO0LRn5q+8nbTov4+1p"
    crossorigin="anonymous"></script>
  <title>Netflix</title>
</head>
​
<body>
  <div id="netflixapp">
​
    <header>
      <div class="navbar">
​
        <div class="netflix-logo">
          <img src="../images/netflix.svg" alt="">
        </div>
        <ul>
          <li>Home</li>
          <li>TV Shows</li>
          <li>Movies</li>
          <li>New & Popular</li>
          <li @click="watchList">My List</li>
          <li id="username">{{username}}</li>
          <li><a class="logout" @click="logout"></a>Logout</li>
        </ul>
      </div>
​
​
      <div class=slideShow>
        <div id="carouselExampleIndicators" class="carousel slide" data-bs-ride="carousel">
          <div class="carousel-indicators">
            <template v-for="(slide,index) in moviesComingSoon">
              <button type="button" data-bs-target="#carouselExampleIndicators" data-bs-slide-to="index"
                :class="{active: index ===0}" aria-current="index === 0" aria-label="slide.name"></button>
              <button type="button" data-bs-target="#carouselExampleIndicators" data-bs-slide-to="index"
                :class="{active: index ===0}" aria-current="index === 1" aria-label="slide.name"></button>
              <button type="button" data-bs-target="#carouselExampleIndicators" data-bs-slide-to="index"
                :class="{active: index ===0}" aria-current="index === 2" aria-label="slide.name"></button>
            </template>
          </div>
        </div>
      </div>
    </header>
​
    <div v-for="m in movies">
      {{m}}
    </div>
​
​
    <main>
      <div class="carousel-inner">
        <template v-for="(slide, index) in moviesComingsoon">
          <div :class="{'carousel-item': true, active: index === 0}">
            <img :src="movie.name" class="d-block w-100" alt="Movie Coming Soon">
            <div class="carousel-caption d-none d-md-block">
              <h5>{{slide.name}}</h5>
              <p>{{slide.availDate}}</p>
            </div>
          </div>
          <button class="carousel-control-prev" type="button" data-bs-target="#carouselExampleCaptions"
            data-bs-slide="prev">
            <span class="carousel-control-prev-icon" aria-hidden="true"></span>
            <span class="visually-hidden">Previous</span>
          </button>
          <button class="carousel-control-next" type="button" data-bs-target="#carouselExampleCaptions"
            data-bs-slide="next">
            <span class="carousel-control-next-icon" aria-hidden="true"></span>
            <span class="visually-hidden">Next</span>
          </button>
        </template>
      </div>
      <!-- </div> -->
      
      <section>
        <div class="movies">
​
          <div class="movie-genre">
            <h2>Comedy</h2>
          </div>
​
          <ul class="list-of-movies">
            <li v-for="(movie, index) in comedy" :key="movies.id" @mouseover="movie.slideshowindex = index"
              @mouseout="movie.slideshowindex = null" :class="{'list-card':movie.slideshowindex}"></li>
          </ul>
​
​
          <div class="card">
            <img src="Movie.thumbnail" class="card-img-top" alt="Movie Image">
            <div class="card-body" v-show="movies.showByIndex === index">
              <div class="movie-info"></div>
              <p class="card-text">{{movies.name}}</p>
              <p class="card-text">{{movies.duration}} • {{movies.genre}}</p>
            </div>
          </div>
​
​
        </div>
      </section>
    </main>
​
  </div>
</body>
​
</html>

SVG on top of another div triggers its mouseleave pointer-event

I’m currently stuck with html and Javascript (in a React project).

Situation

(see picture at the bottom)

I have victory js chart (just a simple graph) as svg above another div A element. That chart has the property click-through and pointer-events-none.
Now, when one hovers over the div A another div B is shown (display: "block").
My goal is now, that on mouseLeave in regards to that div A, div B gets the property display: "none".

This all works however, due to the chart that is above div A, its graph-lines triggers the pointer-event that I just described.

Code in regards of the pointer-event mouseleave of div A

 function handleMouseHover(arg: any) {
        const parent = arg.el.parentNode; //arg is provided by another framework - not important for this question
       
 
            const div = document.createElement('div');
            div.style.display = 'block';
            parent.addEventListener('mouseleave', () => {
                div.style.display = 'none';
            });
            parent.appendChild(div);
}

Code in regards of victory js

const Graph: React.FunctionComponent<IGraphProps> = (props) => {
    return (
        <div className=' click-through pointer-events-none'>
            <svg className="" pointer-events="none" width={1560} height={262} transform="rotate(90), translate(600,700)">
                <VictoryChart
                    style={{
                        parent: { pointerEvents: 'none' }
                    }}
                    theme={VictoryTheme.material}
                    domain={{ y: [0, 7] }}
                    horizontal={false}
                    standalone={false}
                    width={1605}
                    height={262}
                >
                    <VictoryArea
                        interpolation={'stepBefore'} //monotoneX
                        style={{
                            data: {
                                fill: '#c43a31',
                                stroke: '#c43a31',
                                pointerEvents: 'none'
                            },
                            parent: { border: '1px solid #ccc', pointerEvents: 'none' }
                        }}
                        animate={
                            props.showAnimation
                                ? {
                                      duration: 2000,
                                      onLoad: { duration: 1500 }
                                  }
                                : false
                        }
                        data={props.data}
                    />
                </VictoryChart>
            </svg>
        </div>
    );
};

Picture for further clarifications (The dotted white lines are from the svg which trigger mouseleave): enter image description here

For other reasons, the svg has to go behind div A

Props object not working on mounted method

i have preFile variable whitch is coming from props and i am changing on mounted method but when i try to use preFile to pass fileProcess method, for is not not working but if i call fileProcess from enother method everyting working fine. I cannot find what is problem why my method is not working when i call on mounted

enter image description here

on mounted :

 mounted() {
    let FileURL = this.asset + '/' + this.id + '/' + this.preData[0]['name']
    let file = []
    let index = 0
    Object.entries(this.preData).forEach(entry => {
        let FileURL = this.asset + '/' + this.id + '/' + entry[1]['name']
        this.GetFileObjectFromURL(FileURL, function (fileObject) {
            file[index] = fileObject
            index++
        }, entry[1]['name'])
    });
    this.preFile = file
    console.log(this.preFile)
    if (this.gallery){
        this.fileProcess(this.preFile)
    }else{
        this.gallery = true
        this.fileProcess(this.preFile)
    }
},

diffetrent method (i am calling this method with click):

 asd(){
        console.log(this.preFile)
        if (this.gallery){
            this.fileProcess(this.preFile)
        }else{
            this.gallery = true
            this.fileProcess(this.preFile)
        }
    },

and fileProcess method:

fileProcess(files){
        for (let key in files){
            
        }
    },

How to pass data via javascript of a form to a web service in c and execute an update query

my question concerns the two programming languages c and javascript and the use of a web service.
I have this function, created by me in javascript, which if pressed the button with the value of the id in question, retrieves the value of the selected record by printing it inside a form through an ajax call.

var showValue = function(val) {
        var valore = parseInt(val);
        jQuery.ajax({
            url: pacchetti_wsurl + 'ws_json_gestionepacchetti800',
            type: 'GET',
            data: {
                ws_login: readCookie("wc_login").replace(/"/g, ""),
                ws_password_type: 'C',
                ws_pwd: encodeURI(readCookie("wc_password").replace(/"/g, ""))
            },
            dataType: 'json',
            processData: true,
            success: function(json) {
                response = json.Response;
                response[0].Details.forEach(function(element) {
                    if (element["id"] == valore) {
                        input = $('<input class="form-control recordripreso" type="text"/>').val(JSON.stringify(element.nomepacchetto).replace(/"/g, ""));
                        $('#nomepacchetto').append(input);
                        var dropdown = $('#locality-dropdown');
                        dropdown.append($('<option></option>').attr('value', element.abbreviation).text(element.tipotraffico).val(JSON.stringify(element.tipotraffico).replace(/"/g, "")));
                        if (element["tipotraffico"] == 'C') {
                            dropdown.append($('<option value="F">F</option>'));
                        }
                        if (element["tipotraffico"] == 'F') {
                            dropdown.append($('<option value="C">C</option>'));
                        }
                        input = $('<input class="form-control recordripreso" type="text"/>').val(JSON.stringify(element.numerominuti).replace(/"/g, ""));
                        $('#numerominuti').append(input);
                        input = $('<input class="form-control recordripreso" type="text"/>').val(JSON.stringify(element.importocanone).replace(/"/g, ""));
                        $('#importocanone').append(input);
                        input = $('<input class="form-control recordripreso" type="text"/>').val(JSON.stringify(element.loginultimamodifica).replace(/"/g, ""));
                        $('#loginultimamodifica').append(input);
                        input = $('<input class="form-control recordripreso" type="data"/>').val(JSON.stringify(element.dataorainiziovalidita).replace(/"/g, ""));
                        $('#dataorainiziovalidita').append(input);
                    }
                });
            },
            error: function() {
                alert("json not found");
            }
        });
    }   

What I’m trying to do is that if the user changes the value of my inputs or / and select options, it stores me on a button, the value of those parameters, sending them to the web service written in c and an update query is triggered. How can I do? Can anyone kindly give me a hand?

Array to column

I have an application where the user selects the words he will save. I write all these words into an array. I need to display each element of this array in a column so that when hovering over you could see the information (or by clicking)
How can I arrange array elements in a column?

Array:
let a = [“First word”,”Second word”,”Third word”]

An example of what I need:

  • First word
  • Second word
  • Third word

Need to display it on the page through textContent or innerHTML or something like that.