Message from JavaScript discussions

October 2020

— Probably not possible with dynamic scripts


I mean, I guess you could just request the urls of the static scripts early using XMLHttpRequest or something

— And make sure to have cache headers?

— Or with HTTP2 server can just push the scripts, so it doesn't really matter when you set the script tag

Message permanent page

— True, but I am already thinking about dropping the main optimization which caused all the other issues. I just wanted to have target based bundles for the custom js code, but that fucked up all the legacy stuff as my scripts are dynamically added based on feature detection

Message permanent page

— I want to trigger php function using javascript but not working

— Can you share the code in plain text? using pastebin or hastebin

— <?php
function change(){
header("location: register.php");
<!DOCTYPE html>
<html lang="en">
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
.box {
height: 100px;
width: 100px;
background-color: green;

<div class="box" onclick="my()">
<button>Click me</button>

function my() {
var trigger = <?php change(); ?>

Message permanent page

— You cannot call a php function from javascript.

— Php is a server. It serves data via HTTP.

— Here you use javascript on the browser (client-side) to interact with the user

— Then what is the way