I want to show a video or Lottie animation for my React Weather App

I am a beginner who is learning react.js and I have made a Weather app through React JS Tutorial – Build a Weather App With Cities Autocomplete and now I want to add my lottie animation to appear when a user visits and after the lottie animation goes after 4 seconds then the content of the application appears. Please help me achieve this.

Thank you

I tried to create another component VideoPlayer.jsx and then put the lottie on it and then added a variable and used useEffect:

const VideoPlayer = ({ onVideoEnd }) => {
  const [videoLoaded, setVideoLoaded] = useState(false);


  useEffect(() => {
    const handleVideoLoad = () => {
      setVideoLoaded(true);
    };

    const handleVideoEnded = () => {
      if (onVideoEnd) {
        onVideoEnd();
      }
    };

    const videoElement = document.getElementById('myVideo');
    videoElement.addEventListener('loadeddata', handleVideoLoad);
    videoElement.addEventListener('ended', handleVideoEnded);

    return () => {
      videoElement.removeEventListener('loadeddata', handleVideoLoad);
      videoElement.removeEventListener('ended', handleVideoEnded);
    };
  }, [onVideoEnd]); 

give it an absolute position and z-index of 1000.

In the return, i added

{!videoLoaded && <p>Loading video...</p>}
<video id="myVideo" width="100%" height="100%" autoPlay muted>
        <source src="lottie.json" type="lottie/json" />
</video>

Vercel deployment fail

I can’t able to deploy my nextjs webapp on vercel.

This is the log im getting:

Running build in Washington, D.C., USA (East) – iad1
Cloning github.com/Skelptin/FE-Assignment (Branch: main, Commit: 8a4063b)
Skipping build cache, deployment was triggered without cache.
Cloning completed: 317.585ms
Running "vercel build"
Vercel CLI 33.5.3
Running "install" command: `npm install`...

and this is what is shown:

Build Failed
Command "npm run build" exited with 1

I have tried multiple things like setting env_var to cf=false but still I didn’t find any solution.

Request is not being processed to backend

I have page of notes, and when user click on each note, I make a request to backend (basically a get request that get invoked on onClick event when clicking on the note) to check if that user who made the request is owner of this note or not, however the request is not being processed at all.

I am using Next.ts on frontend:


  const handleOpenDialog = async (note:Note)=>{
        const data = await fetch(`http://127.0.0.1:8000/notes/${note.slug}/`,{credentials:'include'})
        console.log(data)


    }


function mapNotes(){
        return(
        notes.map((note,i)=>{
            return(
            <div onClick={()=>handleOpenDialog(note)} key={note.slug} id={note.slug} className='noteContainer'>
      
                <div className='headerSection'>
                    <div className='likeDiv'>
                        LIKES HERE
                    </div>
                    <div className='copyDiv'>
                        COPY ICON HERE
                    </div>
                </div>
                <div className='upperSection'>
                <div className='noteTitle'>
                    {note.title}
                </div>
            <div className='noteDesc'>
                {note.description.slice(0,10)+'...'}
            
            </div>
            </div>

            <div className='lowerSection'>
                <div className='noteUser'>
                    {note.username}
                </div>
                <div className='noteDate'>
                    {note.date}
                </div>
                <div className='noteSpace'>
                    {note.space}
                </div>
            </div>

            <div className='footerSection'>
                <div className='socialSection'>
                    <div className='facebook'>
                        FB
                    </div>
                    <div className='twitter'>
                        X
                    </div>
                    <div className='reddit'>
                        RDT
                    </div>
                    <div>
                        AM I THE OWNER OF THIS NOTE? {note.isOwner}
                    </div>
                </div>
            </div>

            
        <Dialog  id={note.slug} open={dialogId == note.slug} onClose={()=>setDialogId('')}>

            <div className='closeBtn' >
                    <button onClick={()=>setOpen(false)}>Close</button>

                </div>
                <div className='noteExpand'>
                    <div className='likeSection'>
                        LIKES HERE
                    </div>
                    <div className='titleSection'>

                        <div className='title'>
                            {note.title}
                        </div>

                        {!activateTextEdit?<div className='descSection'>
                        {note.description}</div>: <TextareaAutosize className='desc' name='description' value={desc} onChange={(e)=>handleDescEditChange(e,note)}/>}
                    

                        <div className='space'>
                            {note.space}
                        </div>
                        <div className='user'>
                            {note.username}
                        </div>
                        <div className='date'>
                            {note.date}
                        </div>

                    </div>
                 
                </div>
                <div className='modify'>
                    {note.isOwner?<div>
                        {activateTextEdit?<button className='edit' onClick={()=>setActivateTextEdit(true)}>Edit</button>:<button onClick={(e)=>clickOnEdit(e,note)}  className='editSub'>Submit</button>}
                        <button className='delete'>Delete</button>
                        <div>{error}</div>
                    </div>:null}
                </div>
                </Dialog>

            </div>

            
            
            )
        })

        )
    }

the route in backend (Express):

router.get('/notes/:slug',async (req:Request,res:Response)=>{
    // this route is triggered when client is accessing a specific note dialog
    //the purpose of this route is to check if the user on the other side is the owner of that note.
    console.log('hello')

    const param = req.params.slug
    const user = await pool.query('SELECT user FROM note WHERE slug = $1 ',[param])
    if(req.session!.userId == user.rows[0]){
        res.status(200).json({isOwner:true})
    }
    else{
        res.status(401).json({isOwner:false})
    }
})

regarding logging, I tried logging “hello world” inside handleOpenDialog function before the fetch function and it is being logged, however, it seem that fetch request is not being processed at all, in addition, nothing in the backend is being logged.

EDIT:

Here is my CORS settings in backend:


app.use(cors({
    'origin':['http://localhost:3000','http://127.0.0.1:3000'],
    'credentials':true,
}))

My frontend origin is : 127.0.0.1:3000

My backend origin is : 127.0.0.1:8000

I allowed the frontend origin

I also want to mention that other routes are working normally on both sides, it is just this specific case that is not working for some reason.

Screenshot on what I see on the network tab:

enter image description here

enter image description here

Stripe processing doesn’t work in my java script file

I’m trying to use a Java script for payment but something is wrong and I get the following errors in the browser console:

checkout.js:26
POST http://localhost:8080/create-payment-intent 405 (Method Not Allowed)
initialize @ checkout.js:26
        (anonymous) @ checkout.js:13
checkout.js:59  Uncaught (in promise) IntegrationError: In order to create a linkAuthentication element, you must pass a clientSecret or mode when creating the Elements group.
        e.g. stripe.elements({clientSecret: "{{CLIENT_SECRET}}"})
at $t (v3/:1:279900)
at Vn (v3/:1:327665)
at new t (v3/:1:332993)
at t.<anonymous> (v3/:1:346309)
at t.create (v3/:1:101574)
at initialize (checkout.js:41:48)

The code in HTML and js is not mine, I found it on You Tube, but when I downloaded the project everything worked fine
but now, unfortunately, I’m getting these errors. Spring security may be a problem?
Here is the link to the author’s project https://github.com/davidmbochi/stripe-spring-boot
Here is my gitHub project https://github.com/DawidZelezniak420/Courses-App

How process works in my app :
1.My html form sends data to checkout-form.html

package com.zelezniak.project.controller;

import com.zelezniak.project.dto.PaymentInfo;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.ModelAttribute;
import org.springframework.web.bind.annotation.PostMapping;


@Controller
@Slf4j
public class CheckoutController {
    @Value("${stripe.api.publicKey}")
    private String publicKey;

    @PostMapping({"/checkout"})
    public String showCard(@ModelAttribute PaymentInfo paymentInfo, Model model) {
        model.addAttribute("publicKey", this.publicKey);
        model.addAttribute("amount", paymentInfo.getAmount());
        model.addAttribute("email", paymentInfo.getEmail());
        model.addAttribute("productName", paymentInfo.getProductName());
        return "checkout-form";
    }
}

2.checkout-form.html retrieves the data

<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="utf-8" />
    <title>Accept a payment</title>
    <meta name="description" content="A demo of a payment on Stripe" />
    <meta name="viewport" content="width=device-width, initial-scale=1" />
    <link rel="stylesheet" href="/checkout.css" />
    <script src="https://js.stripe.com/v3/"></script>

    <script th:inline="javascript">

        /*<![CDATA[*/

        var publicKey = /*[[${publicKey}]]*/ null;
        var amount = /*[[${amount}]]*/ null;
        var email = /*[[${email}]]*/ null;
        var productName = /*[[${productName}]]*/ null;

        /*]]>*/
    </script>

    <script src="/checkout.js" defer></script>
</head>
<body>
<!-- Display a payment form -->
<form id="payment-form">
    <span>You are about to make a payment of: </span>
    <span th:text="*{amount}"></span>
    <span>USD</span>
    <div id="link-authentication-element">
        <!--Stripe.js injects the Link Authentication Element-->
    </div>
    <div id="payment-element">
        <!--Stripe.js injects the Payment Element-->
    </div>
    <button id="submit">
        <div class="spinner hidden" id="spinner"></div>
        <span id="button-text">Pay now</span>
    </button>
    <div id="payment-message" class="hidden"></div>
</form>
</body>
</html>

3.The data are sended to checkout.js and in this file i have the problem I mentioned earlier

// This is your test publishable API key.
const stripe = Stripe(publicKey);

// The items the customer wants to buy
const request = {
    amount: amount,
    email: email,
    productName: productName
}

let elements;

initialize();
checkStatus();

document
    .querySelector("#payment-form")
    .addEventListener("submit", handleSubmit);

let emailAddress = '';
// Fetches a payment intent and captures the client secret

let paymentIntentID = '';

async function initialize() {
    const response = await fetch("/create-payment-intent", {
        method: "POST",
        headers: { "Content-Type": "application/json" },
        body: JSON.stringify(request),
    });

    const { intentID, clientSecret } = await response.json();

    paymentIntentID = intentID;

    const appearance = {
        theme: 'stripe',
    };
    elements = stripe.elements({ appearance, clientSecret });

    const linkAuthenticationElement = elements.create("linkAuthentication");
    linkAuthenticationElement.mount("#link-authentication-element");

    linkAuthenticationElement.on('change', (event) => {
        emailAddress = event.value.email;
    });

    const paymentElementOptions = {
        layout: "tabs",
        defaultValues: {
            billingDetails:{
                email: request.email
            }
        }
    };

    const paymentElement = elements.create("payment", paymentElementOptions);
    paymentElement.mount("#payment-element");
}

console.log(paymentIntentID);

async function handleSubmit(e) {
    e.preventDefault();
    setLoading(true);

    const { error } = await stripe.confirmPayment({
        elements,
        confirmParams: {
            // Make sure to change this to your payment completion page
            return_url: "https://dashboard.stripe.com/test/payments/"+paymentIntentID,
            receipt_email: emailAddress
        },
    });

    // This point will only be reached if there is an immediate error when
    // confirming the payment. Otherwise, your customer will be redirected to
    // your `return_url`. For some payment methods like iDEAL, your customer will
    // be redirected to an intermediate site first to authorize the payment, then
    // redirected to the `return_url`.
    if (error.type === "card_error" || error.type === "validation_error") {
        showMessage(error.message);
    } else {
        showMessage("An unexpected error occurred.");
    }

    setLoading(false);
}

// Fetches the payment intent status after payment submission
async function checkStatus() {
    const clientSecret = new URLSearchParams(window.location.search).get(
        "payment_intent_client_secret"
    );

    if (!clientSecret) {
        return;
    }

    const { paymentIntent } = await stripe.retrievePaymentIntent(clientSecret);

    switch (paymentIntent.status) {
        case "succeeded":
            showMessage("Payment succeeded!");
            break;
        case "processing":
            showMessage("Your payment is processing.");
            break;
        case "requires_payment_method":
            showMessage("Your payment was not successful, please try again.");
            break;
        default:
            showMessage("Something went wrong.");
            break;
    }
}

// ------- UI helpers -------

function showMessage(messageText) {
    const messageContainer = document.querySelector("#payment-message");

    messageContainer.classList.remove("hidden");
    messageContainer.textContent = messageText;

    setTimeout(function () {
        messageContainer.classList.add("hidden");
        messageContainer.textContent = "";
    }, 4000);
}

// Show a spinner on payment submission
function setLoading(isLoading) {
    if (isLoading) {
        // Disable the button and show a spinner
        document.querySelector("#submit").disabled = true;
        document.querySelector("#spinner").classList.remove("hidden");
        document.querySelector("#button-text").classList.add("hidden");
    } else {
        document.querySelector("#submit").disabled = false;
        document.querySelector("#spinner").classList.add("hidden");
        document.querySelector("#button-text").classList.remove("hidden");
    }
}

4.checkout.js tries to call this method but idk why it doesn’t work

package com.zelezniak.project.controller;

import com.stripe.exception.StripeException;
import com.stripe.model.PaymentIntent;
import com.stripe.param.PaymentIntentCreateParams;
import com.stripe.param.PaymentIntentCreateParams.AutomaticPaymentMethods;
import com.zelezniak.project.dto.PaymentInfo;
import com.zelezniak.project.dto.Response;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;

@RestController
@Slf4j
public class PaymentIntentController {

    @PostMapping("/create-payment-intent")
    public Response createPaymentIntent(@RequestBody PaymentInfo paymentInfo)
            throws StripeException {
        PaymentIntentCreateParams params =
                PaymentIntentCreateParams.builder()
                        .setAmount((long) (paymentInfo.getAmount() * 100L))
                        .putMetadata("productName",
                                paymentInfo.getProductName())
                        .setCurrency("usd")
                        .setAutomaticPaymentMethods(
                                PaymentIntentCreateParams
                                        .AutomaticPaymentMethods
                                        .builder()
                                        .setEnabled(true)
                                        .build()
                        )
                        .build();

        PaymentIntent intent =
                PaymentIntent.create(params);

        return new Response(intent.getId(),
                intent.getClientSecret());
    }
}

I tried to find some solution, but nothing works 🙁

How to get rid of JavaScript KeyUp imperfections or use something else entirely

When I use the key-up event listener in JavaScript, the keys “wait” before starting again. I think it’s because the key-up needs to listen to specific keys but for me that hasn’t worked yet.

I have tried using different tutorials for different perspectives on this problem, but none of them have worked for me yet… I think I just need to not use the key-up event listener but I’m not sure how. I only have only known javascript for a few weeks so I don’t know how to use advanced methods for things.

Cypress config hook issue with running a node script

I have this hook in my cypress.config.ts:

...
            on('after:run', async () => {
                console.log('override after:run')
                await exec('touch ./cypress/reports/test.txt')
                await exec(
                    'npx jrm ./cypress/reports/junitreport.xml ./cypress/reports/junit/*.xml'
                )

                await afterRunHook()
            })
...

The touch command works fine, but the jre don’t produce the junitreport.xml file or any other output.

If I run npx jrm ./cypress/reports/junitreport.xml ./cypress/reports/junit/*.xml on the command line it works just fine.

I have also tried with ./node_modules/.bin/jre instead of npx jrm

as well as node ./node_modules/.bin/jre but to no avail.

What am I missing here?

Next Js right way to call external api

I have NextJs front from which i need to do calls to external python api. I’m new to Next and i just found out that there is integrated api (by creating folders app/api/resource/route). So what is the proper way to call external resource?

  1. Do it just using fetch/axios as you’d did it in react?

  2. Call NextJs’s integrated api and then redirect from that to external?

Does second variant make any sense at all or am I tweakin?

Funciones JavaScript [closed]

“¿Cuáles son las mejores prácticas para declarar, invocar y gestionar funciones en JavaScript, especialmente en términos de rendimiento y mantenibilidad del código?”

Estoy trabajando en la validación de un formulario en JavaScript, pero no estoy obteniendo el comportamiento esperado. He intentado implementar la lógica de validación en la función validarFormulario(), pero parece que no está funcionando correctamente. Siempre se muestra el mensaje de error, incluso cuando los campos están correctamente completados. ¿Alguien podría revisar mi código y proporcionar alguna orientación sobre cómo mejorar la validación del formulario?”enter image description here

how do I hide an element depending on the variable?

num=1
document.getElementById("Num").innerHTML = num
//button to increase/decrease num
function next() {
num++
document.getElementById("Num").innerHTML = num
}
function before() {
num--
document.getElementById("Num").innerHTML = num
}

//hide and show asdf
if (num=1){
document.getElementById("asdf").style.visibility = "hidden";
} else {
document.getElementById("asdf").style.visibility = "visible";
}
<div id="Num"></div>
<button onclick="before()">before</button>
<button onclick="next()">next</button>
<div id="asdf">asdf</div>

I want them to check num and hide or show asdf. I think that num variable is increasing/decreasing as I expected, but asdf isn’t showing. I never used if statement out of function so maybe the problem is in there?

AJAX request to Django view and python print to terminal doesn’t do anything

I am working on a Django website for the nonprofit. I am on the profile images part. I am trying to upload images using the image as a button to submit. I have the file chooser that opens. Then, it submits upon finishing choosing a file. It should be saving the image uploaded to the Django database. So far, my AJAX request to the Django view, its success function works correctly. However, when I try to print to the terminal my test, nothing is printed in the python terminal. Also, the image doesn’t update appropriately.

# sourcetemplatesprofile-pageschild-profile.html
...
<script>
$(document).ready(function () {

    if (typeof jQuery == 'undefined') {
    console.error('jQuery is not loaded!');
    } else {
      console.log('jquery is loaded');
    }
    // Get the image and input elements
    var imageButton = document.getElementById("image-button");
    var fileInput = document.getElementById("file-input");

    // Add a click event listener to the image element
    imageButton.addEventListener("click", function (e) {
      // Simulate a click on the hidden input element
      e.preventDefault();
      fileInput.click();
    });

    // Add a change event listener to the input element
    fileInput.addEventListener("change", function (e) {
      e.preventDefault();
      // Get the selected file from the input element
      var file = fileInput.files[0];
      console.log(file);
      console.log(typeof file);
      // Create a URL for the file object
      if (
        !(
          file.type == "image/jpeg" ||
          file.type == "image/jpg" ||
          file.type == "image/png"
        )
      ){
        alert("Image must be jpeg, jpg or png");
        $("#fileInput").val("");
        return False;
      }
      var formData = new FormData();
        formData.append("newPic", file);
      // Update the image source with the file URL
      // imageButton.src = url;
      $('#submitBtn').submit(submitF(e, formData));
    });

    function submitF(e, pic) {
      e.preventDefault();

      // if (!$("#fileInput").val()) {
      //   alert("Please choose a file");
      // }

      // var formData = new FormData(this);
      console.log("form data. #picform submitted");
      $.ajax({
        headers: {
    'X-CSRFToken': $("input[name=csrfmiddlewaretoken]").val(),
},
        url: "{% url 'users:profile' %}",
        // url: "/profile",
        data: {
          newPic: pic,
          csrfmiddlewaretoken: $("input[name=csrfmiddlewaretoken]").val(),
        },
        method: "POST",
        contentType: false, // Set contentType and processData to false for file uploads
        processData: false,
        success: function (data) {
          alert("success ");
        },
        error: function (xhr, status, error) {
          console.log("AJAX error: ", status, error);
        },
      });

      // $("#imageButton").attr("src", formData);
    }
  });
</script>
...
{% load crispy_forms_tags %}
    <div id="profile-row" class="row g-3">
      <div id="profile-img-container" class="col-md-5">
        <form id="picForm" method="POST" enctype="multipart/form-data">
          {% csrf_token %}
          <input
            id="file-input"
            type="file"
            name="picture"
            accept="image/*"
            style="display: none"
          />
          {% if request.user.profile_pic.url %}
          <img
            id="image-button"
            src="{{ request.user.profile_pic.url }}"
            style="
              width: 100px;
              height: 100px;
              border: 1px solid black;
              cursor: pointer;
            "
          />

          {% elif request.user.profile_pic.url == None %}
          <img src="{% static '/profile-images/default.png' %}" />
          <p>Test</p>
          {% endif %}
          <button type="submit" id="submitBtn" value="Submit">Submit</button>
        </form>
      </div>
...
# usersviews.py
...
@login_required
def profile(request):
    user = get_object_or_404(afbUsers)
    if request.method == 'POST':
        new_pic_file = request.FILES.get('newPic')

        if new_pic_file:
            print('testing 123', new_pic_file.name)

            # Update the logic based on your model and how you want to handle the file
            user.profile_pic = new_pic_file
            user.save()

            messages.success(request, 'Profile image update success!')
            return JsonResponse({'status': 'success'})
        else:
            messages.error(request, 'No file uploaded.')
            return JsonResponse({'status': 'error', 'message': 'No file uploaded.'})
    context = {'user': user}
    return render(request, 'profile-pages/child-profile.html', context)
...

How can I create new link when user clicked in PHP?

There are many links in my project (like a/a.pdf a/b.pdf) (a = folder, a.pdf = file).I want to create new link when user clicked the link. Old folder will be deleted from database(MySQL) and link will be updated to new link in database(MySQL).
(in PHP).

(I’m not native English speaker so I’m sorry for mistakes)

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Link</title>
<script>
function openLink() {
    // Create new random folder name
    var randomFileName = Math.random().toString(36).substring(7);
    // Create new link
    var newFilePath = "books/" + randomFileName + "/a.pdf";
    // Update href
    document.getElementById("myLink").setAttribute("href", newFilePath);
    // Open in new tab
    window.open(newFilePath, '_blank');
}
</script>
</head>
<body>
<a id="myLink" href="books/a/a.pdf" target="_blank" onclick="openLink()">Link</a>
</body>
</html>

From pages to app (NextJS): rest.status is not a function

I am trying to update from Next 13.2.5 to 14.1.0 and use app/api/example/route.js instead of pages/api/example.js.

I get the error TypeError: res.status is not a function at POST in the code below.

My older version of pages/api/example.js is exactly the same but without POST, so I used export async function(req, res) and it works fine. But tried different aspects in the updated version (mentioned here) but I cannot figure out and I am stuck. Any help would be much appreciated.

import { Configuration, OpenAIApi } from "openai";

const configuration = new Configuration({
  apiKey: process.env.OPENAI_API_KEY,
});
const openai = new OpenAIApi(configuration);

export async function POST(req, res) {
  if (!configuration.apiKey) {
    res.status(500).json({
      error: {
        message: "OpenAI API key not configured",
      },
    });
    return;
  }

  const { messages } = req.body;

  if (!Array.isArray(messages)) {
    res.status(400).json({
      error: {
        message: "Invalid conversation format",
      },
    });
    return;
  }

  try {
    const incomingMessages = req.body.messages || [];

    const messages = [
      {
        role: "system",
        content: `This is a roleplay. You are a participant in a market research study, simulating a 
        potential customer's perspective on a new product.
        `,
      },

      ...incomingMessages,
    ];

    const completion = await openai.createChatCompletion({
      model: "gpt-3.5-turbo",
      messages: messages,
      temperature: 0,
      max_tokens: 1000,
    });

    const responseMessage = completion.data.choices[0].message;
    const updatedConversationHistory = [...messages, responseMessage];

    res.status(200).json({ messages: updatedConversationHistory });
  } catch (error) {
    if (error.response) {
      console.error(error.response.status, error.response.data);
      res.status(error.response.status).json(error.response.data);
    } else {
      console.error(`Error with OpenAI API request: ${error.message}`);
      res.status(500).json({
        error: {
          message: "An error occurred during your request.",
        },
      });
    }
  }
}

refreshing DIV or ID without reloading whole page

I am cracking my head over this now for two days… Frustrating. I have a html page which contains divs who get their value from a JS on the page. I am running a loop to refresh them but: Nothing happens. So I am a JS beginner but: Console doesn’t give me an error. jsFiddle says my loop code is ok… WHAT AM I MISSING????

var delay = 1000;

function loop() {

 $.get("http://www.starhit1fm.com/Friday.html")
    .done(function(r) {
      var newDom = $(r);
      $('#imgContainer').replaceWith($('#imgContainer', newDom));
      $('#status').replaceWith($('#status', newDom));
      $('#showon').replaceWith($('#pshowon', newDom));
    });


  if (time >= 0 && time <= 4) {
    imgElement.src = "https://www.starhit1fm.com/images/covers/nonstop1.jpg";
    imgEeight = 70;
    imgElement.width = 70;
    // the image to a container div
    var container = document.getElementById("imageContainer");
    container.appendChild(imgElement);
    var showstatus = "- - - - -&nbsp;&nbsp;Y O U&nbsp;&nbsp;&nbsp;A R E&nbsp;&nbsp;&nbsp;L I S T E N I N G&nbsp;&nbsp;&nbsp;T O&nbsp;&nbsp;- - - - -";
    document.getElementById("status").innerHTML = showstatus;
    var actshow = "&nbsp;Music Non Stop<br>&nbsp;We get you through the night!"
    document.getElementById("showon").innerHTML = actshow;
  }
}
setInterval(loop, delay);
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.7.1/jquery.min.js"></script>
<div align="center">
  <table cellspacing="2" cellpadding="2">
    <tr>
      <td colspan="2" align="center">
        <font face="Verdana" size="3" color="#FF0000"><b><span class="blinking" id="status"></span></b></font>
      </td>
    </tr>
    <tr>
      <td>
        <div id="time"></div>
        <div id="imageContainer"></div>
      </td>
      <td valign="middle">
        <div>
          <span style="font-family: Verdana; font-size: 20px;">
         <b> <span id="showon"></span></b>
          </span>
        </div>
      </td>
    </tr>
  </table>
</div>

This code is supposed to refresh DIV tags or IDs on my html page. I just don’t know anymore where my problem is…. The code is on the same page where the JS is with the if else loops.
You can check the page at www.starhit1fm.com/Friday.html