I got a Frontend of a website but can’t get a bankend or admin for it

I am an IT student and a novice in the world of Development On WEBSITE and APP
I am ready to learn
I extracted a particular website(https://blockchain-poly.uk) with HTTRACK Software, because the front page suit what i needed, But after extracting it, i find only the front page file and i am really confused now cos it seems so difficult for me to get an admin dash board and client dashboard…

Please Help Me
Its Really Urgent.
Yours Sincere.

I want to convert jquery code to vanilla code [duplicate]

my english is not very good

jquery 1.5.2 is required for this code. I wonder if you could change it to vanilla, which doesn’t require a library? I don’t want to download 30 kilobytes of file for so little code. thanks in advance

$(function() {
   $('a').click(function() {
       $(this).addClass('active');
   });
});

Populating the HTML page with the JSON data in Angular

I have the following JSON data but would like to implement the HTML page such that it shows the parent as the header and all the children under the same parent under the content and then follow on by the second parent as the header and all the children under the second parent under the content. How would I be able to do so? An example would be like the following.

Sample 1

Product 1 – Test Product 1

Product 2 – Test Product 2

Sample 2

Product 1 – Test Product 1

sampleList": [
        {
    "parent": "Sample 1",
    "children": [
        {
            "product": "Product 1",
            "name": "Test Product 1",
        }
    ],
    "parent": "Sample 1",
    "children": [
        {
            "product": "Product 2",
            "name": "Test Product 2",
        }
    ],
    "parent": "Sample 2",
    "children": [
        {
            "product": "Product 1",
            "name": "Test Product 1",
        }
    ]
}
]

Having trouble with a hierarchical WordPress sidebar menu. The script always appends the slug so you can’t navigate back up the hierarchy

The menu uses a toggle to drop down child pages. It’s then possible to navigate to a child page, but getting back to the parent page, or a different parent page is impossible, since each time, the slug is appended to the URL.

For example:
https://rogera25.sg-host.com/managing-epilepsy/women-and-epilepsy/
Within the Women and Epilepsy segment I can reach child pages like:
https://rogera25.sg-host.com/managing-epilepsy/women-and-epilepsy/pregnancy-planning/
But I can’t then go back to a different section like ‘Living With Epilepsy’ because this happens, resulting in a 404:
https://rogera25.sg-host.com/managing-epilepsy/women-and-epilepsy/pregnancy-planning/living-with-epilepsy

Can anyone help? Thanks so much for taking the time to read this!

<aside class="sub-menu col mx-auto">

    <ul class="nav flex-column mx-2 menu">

        {% set siblings = post_query({ 
        'post_type': 'page',
        'post_parent': ancestor,
        'orderby': 'menu_order',
        'order': 'ASC'
    }) %}

    <a class="nav-side-title {% if fn('is_page', ancestor.slug) %}active{% endif %}" href="{{ ancestor.link }}">
    
    <h4>{{ ancestor_name }}</h4></a>

    {% for sibling in siblings %}

        {% if sibling.children %}

            <div class="top mx-2 d-flex align-items-baseline">

                <li class="nav-item top-parent has-child collapsed" href="#{{ sibling.slug }}" data-toggle="collapse" aria-controls="{{ sibling.title }}"></li>
                <a class="nav-link {% if fn('is_page', sibling.slug) %}active{% endif %}" href="{{ sibling.slug }}">{{ sibling.title }}</a>
            </div>

            <ul id="{{ sibling.slug }}" class="collapse child-menu" aria-labelledby="{{ sibling.title }}">

                {% for subpage in sibling.children %}

                   {% if subpage.post_type == "page" %}

                    {% if subpage.children %}
                        <div class="mx-3 d-flex align-items-baseline">
                           <li class="nav-item middle-parent has-child collapsed" href="#{{ subpage.slug }}" data-toggle="collapse" aria-controls="{{ subpage.title }}"></li>
                                <a class="nav-link subpage{% if fn('is_page', subpage.slug) %} active{% endif %}" href="{{ subpage.link }}">{{ subpage.title }}</a>

                           </div>
                           <ul id="{{ subpage.slug }}" class="grandchild-menu collapse" aria-labelledby="{{ subpage.title }}">

                            {% for subpage_2 in subpage.children %}
                               {% if subpage_2.post_type == "page" %}


                                <li class="nav-item bottom">
                                    <a class="nav-link subpage{% if fn('is_page', subpage_2.slug) %} active{% endif %}" href="{{ subpage_2.link }}"> {{ subpage_2.title }}</a>
                                </li>



                                    {% endif %}
                                {% endfor %}<!--subpage_2-->
                            </ul>
                        {% else %}<!--subpage.children-->

                            <li class="nav-item middle">
                                <a class="nav-link subpage{% if fn('is_page', subpage.slug) %} active{% endif %}" href="{{ subpage.link }}">{{ subpage.title }}</a>
                            </li>

                        {% endif %} <!--subpage.children-->

                    {% else %}
                            <li class="nav-item middle">
                                <a class="nav-link subpage{% if fn('is_page', subpage.slug) %} active{% endif %}" href="{{ subpage.link }}">{{ subpage.title }}</a>
                            </li>
                        
                    {% endif %}<!--subpage.children page-->

                {% endfor %} <!--subpage-->

            </ul>



        {% else %} <!--sibling.children-->

            <li class="nav-item top">
                <a class="nav-link {% if fn('is_page', sibling.slug) %} active{% endif %}" href="{{ sibling.link }}">{{ sibling.title }}</a>
            </li>


        {% endif %}<!--sibling.children-->

    {% endfor %} <!--sibling-->

    </ul>

</aside>

Javascript method setTimeout() does not work well in Safari browser

I try to develop javascript codes that can give users a warning when the server too long to response the html form submitted. My codes works well in Chrome and Firefox desktop browser, but not in Safari desktop browser.
How to make this works in Safari ? Here are my codes:

<!DOCTYPE html>
<html>
<head>
   <meta charset="UTF-8"/>
   <script type="text/javascript">
      function handleTimeout() {
         document.getElementById("retryButton").disabled = false;
         document.getElementById("message").innerHTML = "Your card's bank 3DS OTP page might be having issue. Please "Tap to retry".";
      }
      function retry() {
         setTimeout(handleTimeout, 5000);
         submitForm();
      }
      function submitForm() {
         return new Promise(function(resolve, reject) {
            document.getElementById('requestForm').submit();
            resolve("done");
         });
      }
      function start() {
         document.getElementById("retryButton").disabled = true;
         setTimeout(handleTimeout, 5000);
         submitForm();
      }
      window.addEventListener('load', (event) => {
         start();
      });
   </script>
</head>
<body>
<form id="requestForm" method="post" action="http://localhost:10877/auth/pareq">
   <input type="hidden" name="PaReq" value="eyJ2ZXJzaW9uIjoiMS4wLjIiLC"/>
   <input type="hidden" name="uuid" value="ac456037-995b-4778-bba5-df614db7ebaa"/>
   <input type="hidden" name="Status" value="Y"/>
</form>
<div id="message">Processing OTP</div>
<p>Tap the button below to Retry</p><br/>
<button id="retryButton" onclick="retry();">Tap to retry</button>
</body>
</html>

Function handleTimeout() is not working in Safari but works well in Chrome and Firefox browser.
How to make function handleTimeout() works well in Safari?

location.href load on the current page/previous url

i have the following jquery for onclick code :

function find(){
$.ajax({
    type: "post",
    url: link + 'register/data',
    data: {},
    success: function () {
        window.location.href= "mycontroller/myfunction"
    }
});

}

i want to make the url stays on mycontroller/myfunction everytime they click the button, i tried substring lastindexof but it keeps adding more url everytime i click the button, how do i make the button stays on that whenever i click it?
thanks in advance

I’m trying to figure out if I’m having trouble understanding the question or the code itself. What do you think? [closed]

I’m currently learning JavaScript on freecodecamp and just had to stop to ask.
When I look at the code (finished layout of a function) it makes sense of what it does.
However, when I read the directions, I simply don’t get it or can’t even picture the finished code. I tend to get stuck on just what it’s asking for me to do. I do spend good amount re-reading everything over and over, but at a point I do google to see the finished product just to understand the requirements for the task.

is it FCC wording the problem? What do you think is my problem?
I get more confused on platform wordings than the actual code.
Block of code I can break it down but with directions it gets confusing of what they want.
Should I just move on? at what point is spending too much time on a question?

Thank you,
D.R.

download multiple files on new tabs using javascript

I am tasked to download the first 25 books from https://www.gutenberg.org/ but I need to download everything at once. Here’s what I have so far.

for (var i = 0; i < 25; i++) {
        var link = "https://www.gutenberg.org/ebooks/"+i+".epub.images";
        window.open(link, "_blank");
};

// https://www.gutenberg.org/ebooks/150.epub.images --> sample link

The approach that I’m looking at is to open multiple new tabs and wait for each one to download the epub file. However, this only downloads the first book and doesn’t continue to the next one.

I already researched on how to open multiple new tabs and on how to download multiple items at once but nothing works. I’m afraid they’re already depreciated since those answers was 5+ years ago.

different ways to use API Keys to gain access to secured data

different ways to use API Keys to gain access to secured data?
i have tried the following code by adding my API key to the URL, and i was wondering if there more ways to do this.

let url:"https://newsapi.org/v2/everything?q=Apple&from=2022-03-07&sortBy=popularity&apiKey02b43b959f494dd6a6e7195a7a43fe02";

let req = new Request(url);

fetch(req)
.then(function(response) {
    console.log(response.json());
})

axios instance not working as expected in React.js

I have a component called Login.js There I import Axios libray normal way and it works like this.

import axios from 'axios';

const data = await axios.post('/user/login/', {
        email: e.email,
        password: e.password,
      });

enter image description here

Getting 404 is fine because I didn’t set any base URL for the Axios. Please note all the requests, response headers here.

Then I try to created Axios instance inside a lib folder and import it like this

/src/lib/axios.js

import axios from "axios";

const baseUrl = process.env.REACT_APP_BE_URL;

const axiosInstance = axios.create({
  baseURL: baseUrl,
});

export default axiosInstance;

I import this instance instead of normal Axios import.

import axios from 'libs/axios';

Now I see the request like this a lot of properties missing in the request and this isn’t working
enter image description here

How do I fix this?

Any help thanks in advance.

Is it possible to get a variable or localStorage value to insert in a Web SQL code?

I’ve created just a simple code to simulate a virtual store with HTML, Web SQL & Javascript language and my question is: Is it possible to get a variable or localStorage value to insert in a Web SQL code?

I just need to change the code number “100013” below by a variable or localStorage item.

var bdd = openDatabase("bdLojaVirtual", "2.0", "LojaVirtual", 2000000);
var mostrar;

var button = document.getElementById("pesquisar");
button.onclick = function consultarProduto() {
    var produto = document.getElementById("codigo").value;
    produto = produto;
    localStorage.setItem("Item selecionado", produto);
}

bdd.transaction(function (selecionar) {
    var produto = localStorage.getItem("Item selecionado");
    selecionar.executeSql ('SELECT nome FROM produto WHERE codigo = 100013', [], 
    function (selecionar, results) {
    var len = results.rows.length, i;
       for (i = 0; i < len; i++) {
           mostrar = "<p><b>" + results.rows.item(i).nome + "</b></p>";
           document.querySelector('#aqui').innerHTML += mostrar;
       }
     }, null);
 });

The whole project is at https://github.com/jmlJunior/portifolioPessoal

What are the fundamental differences between how a browser and a programming language makes a request?

I am trying to scrape one website that has some of the weirdest security I’ve ever seen.

Even when I’m sending a request with matching headers to the ones from the browser, a request that you simply can not distinguish from a browser it instead responds with some random array of bytes, when on browser it works just fine.

I’ve tried other browsers, even Postman worked with the right headers, but the request does not work on JS/Python/Golang.

Can anyone explain how in the hell can a website differentiate if I’m sending a request from the browser or a programming language. How is this possible? I’ve made a simple server just to see if there was ANY kind of difference between a python request and a browser request and was unsuccessful.

How can I fix the update in a fullCalendar

I’m creating a website with symfony 4 my website containts an event table, the events are displayed in a fullcalendar but the problem is when I drag and drop an event the date didn’t change in the database.

    <?php

namespace AppController;

use DateTime;
use Exception;
use SymfonyBundleFrameworkBundleControllerAbstractController;
use SymfonyComponentHttpFoundationResponse;
use SymfonyComponentRoutingAnnotationRoute;
use AppRepositoryEvenementsRepository;
use AppEntityEvenements;
use SymfonyComponentHttpFoundationRequest;

class ApiController extends AbstractController
{
    /**
     * @Route("/api", name="api")
     */
    public function index(): Response
    {
        return $this->render('api/index.html.twig', [
            'controller_name' => 'ApiController',
        ]);
    }

    /**
     * @Route("/api/{id}/edit", name="app_api_edit", methods={"PUT"})
     * @throws Exception
     */
    public function majEvent(?Evenements $calendar, Request $request): Response
    {
        $donnees = json_decode($request->getContent());

        if(
            isset($donnees->libelleE) && !empty($donnees->libelleE) &&
            isset($donnees->dateDE) && !empty($donnees->dateDE) &&
            isset($donnees->dateFE) && !empty($donnees->dateFE)&&
            //isset($donnees->capaciteE) && !empty($donnees->capaciteE)&&
            isset($donnees->descriptionE) && !empty($donnees->descriptionE)&&
            isset($donnees->espaceE) && !empty($donnees->espaceE)
            //isset($donnees->etatEV) && !empty($donnees->etatEV)

        ){

            $code = 200;

            if(!$calendar){

                $calendar = new Evenements;

                $code = 201;
            }
            $calendar->setLibelleE($donnees->libelleE);
            //$calendar->setCapaciteE($donnees->capaciteE);
            $calendar->setDescriptionE($donnees->descriptionE);
            $calendar->setEspaceE($donnees->espaceE);
            //$calendar->setEtatEv($donnees->etatEV);
            $calendar->setDateDE(new DateTime($donnees->dateDE));
            $calendar->setDateFE(new DateTime($donnees->dateFE));

            $em = $this->getDoctrine()->getManager();
            $em->persist($calendar);
            $em->flush();

            // On retourne le code
            return new Response('Ok', $code);
        }else{
            // Les données sont incomplètes
            return new Response('Données incomplètes', 404);
        }



        return $this->render('api/index.html.twig', [
            'controller_name' => 'ApiController',
        ]);
    }
}

andthis is a second controller

    <?php

namespace AppController;

use SymfonyBundleFrameworkBundleControllerAbstractController;
use SymfonyComponentHttpFoundationResponse;
use SymfonyComponentRoutingAnnotationRoute;
use AppRepositoryEvenementsRepository;
use AppEntityEvenements;
use SymfonyComponentHttpFoundationJsonResponse;
class CalendarController extends AbstractController
{
    /**
     * @Route("/calendar", name="app_calendar")
     */
    public function index(EvenementsRepository $calendar): Response
    {
        $events = $calendar->findAll();
        $rdvs = [];
        foreach($events as $event){
            $rdvs[] = [
                'id' => $event->getId(),
                'title' => $event->getLibelleE(),
                'start' => $event->getDateDE()->format('Y-m-d H:i:s'),
                'end' => $event->getDateFE()->format('Y-m-d H:i:s'),
                'description' => $event->getDescriptionE(),
                'espace' => $event->getEspaceE(),
                //'capacite' => $event->getCapaciteE(),
                //'etat' => $event->getEtatEv(),
            ];
        }
        $data = json_encode($rdvs);
        return $this->render('calendar/index.html.twig', compact('data'));
    }
}

this is my twig page it contains the calendar and soe events displayed


    {% extends 'base.html.twig' %}

{% block title %}Calendrier{% endblock %}
{% block stylesheet %}
    <style>
        #calendrier{
            width: 80%;
            margin: auto;

        }
    </style>
{% endblock %}
{% block body %}

    <div class="container">
        <div id="calendrier">

        </div>
    </div>
{% endblock %}
{% block javascripts %}
    <script>

        window.onload = () => {
            let calendarEl = document.querySelector("#calendrier");
            let calendar = new FullCalendar.Calendar(calendarEl, {
                initialView: 'dayGridMonth',
                locale: 'fr',
                timezone: 'Europe/paris',
                headerToolbar: {
                    start: 'prev,next today',
                    center: 'title',
                    end: 'dayGridMonth,timeGridWeek'
                },
                events : {{ data|raw }},
                editable : true,
                eventResizableFormStart : true
            })

            calendar.on('eventChange', (e) => {
                let url = `/api/${e.event.id}/edit`
                let donnees ={


                    "title": e.event.title,
                    "start": e.event.start,
                    "end": e.event.end,
                    //"capacite": e.event.capacite,
                    "description": e.event.extendedProps.description,
                    "espace": e.event.extendedProps.espace
                    //"etat":e.event.editable.etat,

                }
                let xhr = new XMLHttpRequest

                xhr.open("PUT", url)
                xhr.send(JSON.stringify(donnees))
            })
            calendar.render()
        }

    </script>
{% endblock %}

Are inline attached events always checked after events added by addEventListener in html/javascript?

I’m adding an event-handler by using

window.addEventListener('keydown',mainf); 

and in a child-span element inserted later using innerHTML= I have an inline eventhandler like

<span id="closeLink" onkeypress="this.onclick(event);" tabindex="1" onclick="closef(event);">Close</span>

If I use the tab key to put the focus on the span-element and hit the Enter-key, the console-output in the functions mainf and closef show that closef is called after mainf, though closef-event-phase shows 2,but mainf-event-phase shows 3.

mainf event.target.id is closeLink 
mainf current event.eventPhase: 3

closef event: keypress { target: span#closeLink, key: "Enter", charCode: 0, keyCode: 13 }
closef current event.eventPhase: 2

So, are inline attached events always checked after events added by addEventListener in html/javascript?

I’m using Firefox 91.3

Javascript – How to calculate pagination range number for each page of dynamic dataset?

Im building an automatic pagination calculator that calculates offset and range according to user input. A very simple task but my algorithm is off. You can try this by entering any number and you will see the numbers do not completely add up. How can I make this work?

//event listener
var button = document.getElementById('submit');

//click
button.addEventListener('click',function(){
  
//div results  
var results = document.getElementById('results');
  
//clear div before appending
results.innerHTML= '';

//grab value
var total_items = document.getElementById('total_items').value;//331165139
var per_page =  document.getElementById('items_per_page').value;

//total pages
var total_pages = Math.ceil(total_items/per_page);

//iterate over pages
for(var x = 0; x<total_pages; x++){

//get page
var page = x+1;

//offset
var offset = (per_page * page) - per_page;

//range from
var from = ((page - 1) * per_page) + 1 ;

//range to
var to = per_page * page
var range = from + ' - ' + to;

//creating divs
var newDiv = document.createElement('div');
newDiv.innerHTML =  'page : ' + page + ' | offset : ' + offset + ' | range : ' + range + ' | total : ' + (to-from);
results.appendChild(newDiv);
 
}

})
<h3>Pagination Calculator</h3>
<hr>
<p>Calculates pagination automatically in the console</p>
<p>*Pop open the console</p>
<hr>
<label>total items </label>
<input id="total_items">
<label>limit per page</label>
<input id="items_per_page">
<button id="submit">Submit</button>
<hr>
<div id="results"></div>