Changing a video to a different video when clicking on a div

I’m making a playlist and when you click on one of the videos on the playlist I want it to change to a different video, but I’m not able to get it to work. I want the video to go from episode 1 to episode 2, but how would I go about doing that? I added a click event so when you click on any of the playlist items I want it to do something. I want it to change from episode 1 to episode 2. I tried setting the playlist videos equal to the main video, but that doesn’t change the video. I have my main video on the left handside and my playlist videos on the right hand side.

HTML Code:

<!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">
    <title>Video Playlist</title>
    <link rel="stylesheet" href="style.css">
</head>
<body>
    <div class="container">
        <div class="video-and-playlist-container">
            <div class="main-video-container">
                <video 
                    src="videos/Episode_1.MP4" 
                    loop 
                    controls 
                    poster="image/youtube-overlay.PNG"
                    class="main-video">
                </video>
            </div>
            <div class="video-list-container">
                <div class="playlist-header">
                    <p class="playlist-header-title">Episode List</p>
                </div>
                <div class="list-container">
                    <div class="list active">
                        <video 
                            src="videos/Episode_1.MP4"
                            poster="https://i.ytimg.com/vi/_jPLDLngDAs/mqdefault.jpg"  
                            class="list-video">
                        </video>
                        <p class="list-title">From Ground Zero to Career Superhero! | Career Transforming Docuseries | Episode 1 | Super Purposes</p>
                    </div>

                    <div class="list">
                        <video 
                            src="videos/Episode_2.MP4"  
                            poster="https://i.ytimg.com/vi/1uBvUObNzVY/hqdefault.jpg?sqp=-oaymwEiCKgBEF5IWvKriqkDFQgBFQAAAAAYASUAAMhCPQCAokN4AQ==&rs=AOn4CLDUvCB8hkoA9x8XKnBduZeLQuXGBQ"
                            class="list-video">
                        </video>
                        <p class="list-title">Career Docuseries | Episode 2: Turning Obstacles into Experience and Using LinkedIn As Your Platform</p>
                    </div>

                    <div class="list">
                        <video 
                            src="videos/Episode_3.mp4"  
                            poster="https://i.ytimg.com/vi/zUVRxR-P69M/hqdefault.jpg?sqp=-oaymwEiCKgBEF5IWvKriqkDFQgBFQAAAAAYASUAAMhCPQCAokN4AQ==&rs=AOn4CLCLE_MEr33No59PuT5wtqy5xQiW6Q"
                            class="list-video">
                        </video>
                        <p class="list-title">Career Docuseries | Episode 3: Tapping Into The Power Of Your LinkedIn Network</p>
                    </div>
                </div>
            </div>
            <div class="description">
                <div class="description-title">Episode 1: Super Purposes</div>
            </div>
        </div>
    </div>
    <script src="script.js"></script>
</body>
</html>

CSS code:

.container .video-and-playlist-container {
    border: 0.5px solid black;
    display: flex;
    flex-wrap: wrap;
    width: 100%;
    height: 500px;
    flex-direction: row;
    align-items: center;
    justify-content: center;
}

/* main video container */
.container .video-and-playlist-container .main-video-container {
    width: 60%;
    height: 450px;
    margin-right: 30px;
}

.container .video-and-playlist-container .main-video-container .main-video {
    height: 450px;
    width: 100%;
}

/* playlist container */
.container .video-and-playlist-container .video-list-container {
    width: 30%;
    height: 450px;
    border: 1px solid black;
    overflow: hidden;
}

/*playlist header container - Episode List */
.container .video-and-playlist-container .video-list-container .playlist-header {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 40px;
    background-color: #3F3D3E;
}

.container .video-and-playlist-container .video-list-container .playlist-header .playlist-header-title {
    color: #ffffff;
    font-size: 15pt;
    font-family: lato, san-serif;
}

/* list container */
.container .video-and-playlist-container .video-list-container .list-container {
    height: 100%;
    overflow-y: scroll;
}

/* list contains every box for each video and title */
.container .video-and-playlist-container .video-list-container .list-container .list {
    display: flex;
    align-items: center;
    gap: 5px;
    cursor: pointer;
    border-radius: 5px;
    margin-bottom: 10px;
}

.container .video-and-playlist-container .video-list-container .list-container .list:hover {
    background-color: #d5dadf;
}

.container .video-and-playlist-container .video-list-container .list-container .list .list-title {
    font-family: lato, san-serif;
}

.container .video-and-playlist-container .video-list-container .list-container .list.active {
    /*background-color: #f1f3f5;*/
    background-color: #d5dadf;
}

.container .video-and-playlist-container .video-list-container .list-container .list .list-video {
    width: 200px;
    height: 100px;
}

JavaScript Code:

let mainVideo = document.querySelector(".main-video").src;
let listVideos = document.querySelectorAll(".list-video");
const lists = document.querySelectorAll(".list");

for (i = 0; i < lists.length; i++) {
    lists[i].addEventListener("click", changeVideo());
}

function changeVideo() {
    for (i = 0; i < listVideos.length; i++) {
        let srcVideos = listVideos[i].src;
        mainVideo = srcVideos;
    }
}

Property “Xyz” does not exist on type after renaming jsx file to tsx despite having type definitions

I am trying out d3 based sunburst-chart in react. The component looks something like follows:

SunburstChart.js

import SunburstChart from "sunburst-chart";
import fromKapsule from "react-kapsule";

const ReactSunburst = fromKapsule(SunburstChart, {
  methodNames: ["focusNode"]
});

const Chart = ({ data }) => (
  <ReactSunburst
    //...
    data={data}
  />
);

export default Chart;

App.js

import SunburstChart from "./components/SunburstChart";
import multisats from "./data/mulstats.json";

export default function App() {
  return (
    <div className="App">
      <h1>Hello CodeSandbox</h1>
      <h2>Start editing to see some magic happen!</h2>
      <div className="chart">
        <SunburstChart data={multisats} />
      </div>
    </div>
  );
}

This works as can be seen in this sandbox. However, I want to use this in typescript. So, I simply tried to change extension from SunburstChart.js to SunburstChart.tsx hoping that it will work out of the box. But I ended up getting following error (check another sandbox):

Type '{ width: number; height: number; excludeRoot: true; label: string; size: string; color: string; centerRadius: number; minSliceAngle: number; radiusScaleExponent: number; tooltipContent: (d: any, node: any) => string; data: any; }' is not assignable to type 'IntrinsicAttributes & { ref?: MutableRefObject<{}>; } & { children?: ReactNode; }'.
  Property 'width' does not exist on type 'IntrinsicAttributes & { ref?: MutableRefObject<{}>; } & { children?: ReactNode; }'.ts(2322)

I am getting same error in my local machine. Though, the sandbox is still rendering the sunburst visualization, my local setup is not rendering it. The sunburst-chart repo does specify type definitions in index.d.ts file. Why I am still getting this type related error? Is it because of fromKapsule()?

How can I get my html page to refresh upon completion of a django function?

I keep getting an error related to the csrf token when I try to employ consecutive submissions, and refreshing the page seems to work. The purpose of the program is to create zip files, so I figured the easiest solution would be to have the web page automatically reloaded once the zip file is done being created from the function in the views.py file and available for the user to open. The main issue I’m having is how to actually do that.

Here is the code for my HTML file:

{% load static %}

<html>
<head>
    <link rel="stylesheet" href="{% static '/styleSheet.css' %}">

    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edstore">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">


    <!--BOOTSTRAP ASSETS-->
    <link href="https://fonts.googleapis.com/css2?family=Quicksand:wght@400;700&display=swap" rel="stylesheet">
    <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.6.0/jquery.min.js"></script>

    </head>
    <body>
       <form enctype="multipart/form-data" action=""  method="post">
        {% csrf_token %}

        <div class="main_Body">
            <div class="section">
                <h1>Fileconverter</h1>
                <br>

                <label for="file_field" class="custom-file-upload">
                    <i class="fa fa-cloud-upload"></i>Updload File(s)</label>
                <input type="FILE" id="file_field" name="file_field" class="file-upload_button" multiple>
                <label id="file_name"></label>
                <br>
                <br><br><br>
            
            <br>
            <input type="submit" class="file-submit__button" id="submitButton"> <!--onclick="formDisableButton"-->

        </div>
    </form> 
</body>


<footer>
    <p>Click "Choose File(s)" and select the files you want to convert.</p>
    <p>Once you click "Submit" the job will start.</p>
    <p>Upon completion, a zip folder will be downloaded in your browser.</p>
    <p>Do not click the submit buttons multiple times. If the tab is loading, the job is being processed.</p>
</footer>

</html>


<script>

  document.querySelector("#file_field").onchange = function(){
  document.querySelector("#file_name").textContent = this.files[0].name;
  }

  const tempButton = document.getElementById("submitButton");
function formDisableButton(){
    tempButton.disabled = true;
    setTimeout(formEnableButton, 10000);
}

function formEnableButton(){
    tempButton.disabled = false;
}

    /*setTimeout(()=>{
        btn.disabled = false;
        console.log('Button Activated')
    }, 10000)*/


   /* $(function(){
        $("#submitButton").click(function(){
            $("#submitButton").attr("disabled", "disabled");
            setTimeout(function(){
                $("#submitButton").removeAttr("disabled");
            }, 10000)
        });
    });*/

And this is the code from my views.py file:

from django.shortcuts import render
from django.shortcuts import redirect
from django.urls import reverse
from django.views.generic.edit import FormView
from django.views.decorators.csrf import csrf_exempt

from .forms import FileFieldForm
from django.http import HttpResponse

from .perform_conversion import FileConverter
import zipfile
import io


def FileFieldFormView(request, *args, **kwargs):
 
form = FileFieldForm(request.POST)
files = request.FILES.getlist('file_field')

if request.method == 'POST':
    print(request)
    form = FileFieldForm(request.POST, request.FILES)
    if form.is_valid():

        
        zip_buffer = io.BytesIO()   
        with zipfile.ZipFile(zip_buffer, "w", False) as zip_file:
            
            for f in files:
                fileconverter = FileConverter(f.name)
                fileconverter.run(f.file)
                
                for img_name, img in fileconverter.output.items():
                
                    data = io.BytesIO(img)
                
                    zip_file.writestr(img_name, data.getvalue())
            
        # Set the return value of the HttpResponse
        response = HttpResponse(zip_buffer.getvalue(), content_type='application/octet-stream')
        # Set the HTTP header for sending to browser
        response['Content-Disposition'] = "attachment; filename=%s" % 'zip.zip'
        response.set_signed_cookie('csrftoken', request.COOKIES['csrftoken'])
        
        
        # Return the response value
        return response

            
    else:
        return HttpResponse('Form Invalid')

else:
    return render(request, 'file_converter.html')
    

As a bonus if you’re willing to provide a bit of extra help, I can’t ever seem to have any sort of onclick for my submission button. Every time I try to add it, the python files never actually end up running and the page just sits there. I’d like to have it so that when the submission button is clicked it is removed form the page to prevent excessive submission attempts and since, in theory, the page will be refreshing after a successful run through, the submit button will just be reposted onto the page.

how to remove trailing and leading spaces from textbox input

if I have something like this:

  return array.map(item => (
<input type="text" value={item.name}> onChange ={(name) => changeItemName(name.target.value)}

where the changeItemName function is basically a function that will change the name attribute of the current item. How can I go about making sure that the name attribute wont have any trailing or leading spaces? I can do something like this in my changeItemName function:

changeItemName(name){
name.trim()
... logic to change name of item }

However since I am using onChange(), this method is called everytime a character is typed. This means that if a user types a regular space between 2 words, this wouldnt work because the name passed into the function would be trimmed thus now allowing any spaces. How can I tweak this so that spaces still work but leading and trailing white spaces are gone?

Cannot acces properites of JSON object

I’m trying to call an API and get the JSON data from that. When I get the data I can’t display the properties of the object.

 useEffect(() => {
  fetch(url)
  .then(response => response.json())
  .then(actualData => {
    console.log(actualData)
    setData(actualData)
  }).catch((err) => {
    setError(err.message)
  })
}, [])
return (
<div>
  <h3>{JSON.stringify(data.name)}</h3>
  <p>{error}</p>
  <Link to='/'>Home</Link>
</div>

Calling function defined within a react function component on a click event form another function component – React.js

I am constructing some node objects in a function(prepareNodes) to pass to React Flow within a functional component A (lets say), and I have defined a custom node component(CardNode) stateless, which has a button. On button click it should trigger the function(prepareNodes) defined within Component A.

    function ComponentA = ({ selectedNodes }) => {
    
         const reactFlowWrapper = useRef(null);
    
         const [elements, setElements] = useState([]);
         const [edges, setEdges] = useState([]);
   
         const prepareNode = async (nodeid) => {
            //some service calls to fetch data and constuct nodes
            setElements([ ...nodes]);
            setEdges([...edges]);
         }

       return (
        <ReactFlowProvider>
          <div className="reactflow-wrapper" ref={reactFlowWrapper}>
            <ReactFlow
              nodes={elements}
              edges={edges}
              //some properties
            >
            </ReactFlow>
          </div>
        </ReactFlowProvider>
       )
   };
   export default ComponentA;


   function CardNode({ data }) {
  
    const renderSubFlowNodes = (id) => {
      console.log(id);
      //prepareNode(id)
    }
  
    return (
        <>
          <Handle type="target" position={Position.Top} />
          <div className="flex node-wrapper">
              <button className="btn-transparent btn-toggle-node" href="#" onClick={() => renderSubFlowNodes(data['id']) }>
                  <div> 
                      <img src={Icon}/>    
                  </div>
              </button>
          </div>
          <Handle type="source" position={Position.Bottom}/>
       </>
    );
  }
  
  export default CardNode;

I looked for some references online, and most of them suggest to move this resuable function out of the component, but since this function carries a state that it directly sets to the ReactFlow using useState hook, I dont think it would be much of a help.

Other references talks about using useCallback or useRefs and forwardRef, useImperativeHandle especially for functional component, Which I did not quite understand well.

Can someone suggest me a solution or a work around for this specific use-case of mine.

instagram automatic dm bot

I am trying to make an Instagram auto dm bot using javascript the bot basically has to do the clicks and fill the inputs then send the message the do the same process again to another user but the problem is when I fill the inputs programmatically the search result does not show up . i tried to trigger keyup keydown and keypress to send the data and get the response but I got errors that the event

keyup keydown and keypress
is not fonction

what the best way to do the process programmatically

When fetching json to js file how do I access the data after the proccess?

I don’t know how to get the data from fetching json file. Here is my code:

async function getTheData() {
    const response = await fetch("./data.json");
    const array = await response.json();
    return array;
}

getTheData().then(array=> {
    console.log(array);
})

[enter image description here][1]

My question is – how do I access data from this call? Earlier I tried creating an empty array before the call and pushing each arr item to that array, and then displaying the arr in setTimeout function, because otherwise I got an empty arr due to asynchrounous order. But I can’t write my full code in setTimeout function only to acces the data from the fetch call. I feel stuck not knowing how to do this. Can someone please teach me how to access the data and store it in a variable? Here’s the second code with my setTimeout tries:

const newArr = [];
const items = fetch("./data.json")
.then(function (response) {
    return response.json();
}).then(function (obj) {
    obj.map(item => newArr.push(item));
}).catch(function (err) {
    console.error(err);
});

console.log(newArr);
setTimeout(() => {(
    console.log(newArr)
    );
  }, 1000) 

[1]: https://i.stack.imgur.com/8rFu6.png Here’s the link to what I get in a console with a first fetch

Load eCharts Multiline with only one series selected by default

I have a multiline chart defined as follows:

{
  tooltip: {
    trigger: 'axis',
  },
  legend: {
    data: ['A', 'B', 'C', 'D'],
  },
  xAxis: {
    type: 'category',
    boundaryGap: false,
    data: labels,
  },
  yAxis: {
    type: 'value',
  },
  series: [
    {
      type: 'line',
      symbol: 'circle',
      emphasis: {
        focus: 'series',
        blurScope: 'coordinateSystem',
      },
      step: 'end',
      name: 'A',
      data: [1, 2, 3],
    }, ...,
  ],
};

When clicking on a legend, it toggles the corresponding line. I would like to load this graph with one of the lines toggled “off” while displaying the others.

Does echarts support that functionality?

JointJS: item added to incorrect position after panning paperScroller

I’m having trouble to get the correct position to items added to the graph after moving items to a new area on the left side of the paper.

Function called when the item is drop on the canvas.

function drop(ev) {
    ev.preventDefault();

    // CANVAS ELEMENT DROP
    var data = ev.dataTransfer.getData("text");
    console.log('ev.pageX: ' + ev.pageX);
    console.log('$(paper-container).offset().left: ' + $('#paper-container').offset().left);
    console.log('$(.joint-paper).position().left: ' + $('.joint-paper').position().left);        
    console.log('ev.pageY: ' + ev.pageY);
    console.log('$(paper-container).offset().top: ' + $('#paper-container').offset().top);
    console.log('$(.joint-paper).position().top: ' + $('.joint-paper').position().top);

    var x = ev.pageX - $('#paper-container').offset().left - $('.joint-paper').position().left;
    var y = ev.pageY - $('#paper-container').offset().top - $('.joint-paper').position().top;
    addCanvasItem(x, y);
}

Then adding item to the canvas:

function addCanvasItem(x, y) {
    //x and y are in the screen referential
    var zoomRatio = vm.paperScroller.zoom();
    var scrollX = vm.paperScroller.el.scrollLeft;
    var scrollY = vm.paperScroller.el.scrollTop;

    var posX = x / zoomRatio + scrollX / zoomRatio - 50;
    var posY = y / zoomRatio + scrollY / zoomRatio - 30;

    item.attributes.position = { x: posX, y: posY };

    item.addTo(vm.graph);

    var cellView = item.findView(vm.paper);

    rappidJsConfig.resetSelection([cellView.model]);

    vm.selectedView = cellView;
    vm.initEditor();

    if (vm.isVisibleType('qad.Question')) {
        var selectedQuestion = document.getElementById("selected-question");
        if (selectedQuestion) {
            selectedQuestion.focus();
        }
    }
};

Any ideas ?

How do i suppress alert popup when HTMLAudioElement.play fails?

I’m having a little web application that plays audio tracks on my PC. they’re converted on-the-fly to the most-supported browser format.
now for some tracks this actually throws an exception… sometimes even in the middle of playing… because i don’t know and this is a different topic.

however, what happens in HTML is that i’m getting an annoying alert. This alert is not made by me, it’s somehow native. I’m already putting the HTMLAudioElement in a try/catch. but sadly this does not prevent the popup.

please tell me how i can get rid of this annoying alert and continue with my code 🙂

 <audio
                controls
                preload="auto"
                @loadedmetadata="${() => playlist.requestUpdate(undefined)}"
                @ended="${() => playlist.changeTrackBy(1)}"
                @timeupdate="${() => playlist.requestUpdate(undefined)}"
                id="audio-player"
                .volume="${playlist.currentVolumne}"
                .src="${playlist.audioSource}"
            ></audio>

JS:

 /** @type {HTMLAudioElement} */ var audioElement = this.shadowRoot.querySelector('#audio-player');

try {
    if (audioElement.paused) await audioElement.play();
    else audioElement.pause();
} catch {
    await this.changeTrackBy(1);
}

 this.requestUpdate(undefined);

PS: I’m using vanilla javascript and LitHtml with JSDoc providing type-safety.

window.echo.channel not working in socket.io

socket.io version “2.3.0”
web.php

use IlluminateSupportFacadesRoute;
use AppEventsMessage;
use IlluminateHttpRequest;
use IlluminateHttpResponse;

/*
|--------------------------------------------------------------------------
| Web Routes
|--------------------------------------------------------------------------
|
| Here is where you can register web routes for your application. These
| routes are loaded by the RouteServiceProvider within a group which
| contains the "web" middleware group. Now create something great!
|
*/

Route::get('/', function () {
    return view('welcome');
});

Route::get('/dashboard', function () {
    return view('dashboard');
})->middleware(['auth'])->name('dashboard');
Route::post('/send-message', function(Request $request){
   event(new Message($request->input('username'), $request->input('message')));
   return["success" => true];
});
require __DIR__.'/auth.php';

Message.php

namespace AppEvents;

use IlluminateBroadcastingChannel;
use IlluminateBroadcastingInteractsWithSockets;
use IlluminateBroadcastingPresenceChannel;
use IlluminateBroadcastingPrivateChannel;
use IlluminateContractsBroadcastingShouldBroadcast;
use IlluminateFoundationEventsDispatchable;
use IlluminateQueueSerializesModels;

class Message implements ShouldBroadcast
{
    use Dispatchable, InteractsWithSockets, SerializesModels;

    public $username;
    public $message;

    /**
     * Create a new event instance.
     *
     * @return void
     */
    public function __construct($username, $message)
    {
        $this->$username = $username;
        $this->$message = $message;
    }

    /**
     * Get the channels the event should broadcast on.
     *
     * @return IlluminateBroadcastingChannel|array
     */
    public function broadcastOn()
    {
        return new Channel('chat');
    }
    public function broadcastAs()
    {
        return 'message';
    }
}

app.js

import './bootstrap';

const messages_el = document.getElementById("messages");
const username_input = document.getElementById("username");
const message_input = document.getElementById("message_input");
const message_form = document.getElementById("message_form");

message_form.addEventListener('submit', function(e){
    e.preventDefault();
    let has_errors = false;
    if(username_input.value == ''){
        alert("Please enter a username");
        has_errors = true;
    }
    if(message_input.value == ''){
        alert("Please enter a message");
        has_errors = true;
    }
    if(has_errors){
        return;
    }
    const options = {
        method: 'post',
        url: '/livechat/public/send-message',
        data: {
            username: username_input.value,
            message: message_input.value
        }
    }
    axios(options);
});
Echo.channel("chat").listen('.message', (e) => {
        console.log(e);
        messages_el.innerHTML += '<div class="message"><strong>' + username_input.value + ':</strong> ' + message_input.value + '</div>';
    });

bootstrap.js

import _ from 'lodash';
window._ = _;

/**
 * We'll load the axios HTTP library which allows us to easily issue requests
 * to our Laravel back-end. This library automatically handles sending the
 * CSRF token as a header based on the value of the "XSRF" token cookie.
 */

import axios from 'axios';
window.axios = axios;

window.axios.defaults.headers.common['X-Requested-With'] = 'XMLHttpRequest';

/**
 * Echo exposes an expressive API for subscribing to channels and listening
 * for events that are broadcast by Laravel. Echo and event broadcasting
 * allows your team to easily build robust real-time web applications.
 */

import Echo from 'laravel-echo';

import Pusher from 'pusher-js';
window.Pusher = Pusher;

window.Echo = new Echo({
    broadcaster: 'pusher',
    key: import.meta.env.VITE_PUSHER_APP_KEY,
    cluster: import.meta.env.MIX_PUSHER_APP_CLUSTER,
    forceTLS: true,
});

dashboard.blade.php

<x-app-layout>
    <x-slot name="header">
        <h2 class="font-semibold text-xl text-gray-800 leading-tight">
            {{ __('Dashboard') }}
        </h2>
    </x-slot>
    <!doctype html>
    <html lang="en">
    <head>
        <style>
            #messages{
                overflow: scroll;
            }
        </style>
        <meta charset="UTF-8">
        <meta name="viewport"
              content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
        <meta http-equiv="X-UA-Compatible" content="ie=edge">
        <title>Document</title>
        <link href="https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-0evHe/X+R7YkIZDRvuzKMRqM+OrBnVFBL6DOitfPri4tjfHxaWutUpFmBp4vmVor" crossorigin="anonymous">
        <script src="https://cdn.jsdelivr.net/npm/@popperjs/[email protected]/dist/umd/popper.min.js" integrity="sha384-Xe+8cL9oJa6tN/veChSP7q+mnSPaj5Bcu9mPX5F5xIGE0DVittaqT5lorf0EI7Vk" crossorigin="anonymous"></script>
        <script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/js/bootstrap.min.js" integrity="sha384-kjU+l4N0Yf4ZOJErLsIcvOU2qSb74wXpOhqTvwVx3OElZRweTnQ6d31fXEoRD1Jy" crossorigin="anonymous"></script>
        <script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/js/bootstrap.bundle.min.js" integrity="sha384-pprn3073KE6tl6bjs2QrFaJGz5/SUsLqktiwsUTF55Jfv3qYSDhgCecCxMW52nD2" crossorigin="anonymous"></script>
    </head>
    <body>

    <form id="message_form">
    <div class="input-group w-50 mx-auto mt-5">
        <input type="text" placeholder="username" name="username" id="username">
        <input class="form-control" placeholder="Message" name="message" id="message_input" aria-label="With textarea"></input>
        <button type="submit" id="message_send" class="input-group-text">Submit</button>
    </div>
    </form>
    <div id="messages">
    </div>
    <script src="./js/app.js"></script>
    </body>
    </html>
</x-app-layout>

.env

APP_NAME=Laravel
APP_ENV=local
APP_KEY=base64:HhX4RMyqvM+Ly9oXH5aViV0I2iVMIMudGTGrox8GV4Q=
APP_DEBUG=true
APP_URL=http://livechat.test

LOG_CHANNEL=stack
LOG_DEPRECATIONS_CHANNEL=null
LOG_LEVEL=debug

DB_CONNECTION=mysql
DB_HOST=127.0.0.1
DB_PORT=3306
DB_DATABASE=livechat
DB_USERNAME=root
DB_PASSWORD=

BROADCAST_DRIVER=pusher
CACHE_DRIVER=file
FILESYSTEM_DISK=local
QUEUE_CONNECTION=sync
SESSION_DRIVER=file
SESSION_LIFETIME=120

MEMCACHED_HOST=127.0.0.1

REDIS_HOST=127.0.0.1
REDIS_PASSWORD=null
REDIS_PORT=6379

MAIL_MAILER=smtp
MAIL_HOST=mailhog
MAIL_PORT=1025
MAIL_USERNAME=null
MAIL_PASSWORD=null
MAIL_ENCRYPTION=null
MAIL_FROM_ADDRESS="[email protected]"
MAIL_FROM_NAME="${APP_NAME}"

AWS_ACCESS_KEY_ID=
AWS_SECRET_ACCESS_KEY=
AWS_DEFAULT_REGION=us-east-1
AWS_BUCKET=
AWS_USE_PATH_STYLE_ENDPOINT=false

PUSHER_APP_ID=1433727
PUSHER_APP_KEY=220f98faf43bfaec9a41
PUSHER_APP_SECRET=d3c3d3d5bbe1198ad277
PUSHER_APP_CLUSTER=eu

VITE_PUSHER_APP_KEY="${PUSHER_APP_KEY}"
VITE_PUSHER_HOST="${PUSHER_HOST}"
VITE_PUSHER_PORT="${PUSHER_PORT}"
VITE_PUSHER_SCHEME="${PUSHER_SCHEME}"
VITE_PUSHER_APP_CLUSTER="${PUSHER_APP_CLUSTER}"

running on XAMPP Apache
i tried to do realtime chat with laravel and pusher with this tutorial https://www.youtube.com/watch?v=vl5CJIhy5oU&t=2869s
There is no any errors in console, but when i’m click submit button, my message isn’t create.i trying to solve this problem about 2 days, please help.