Forum Moderators: open
src attribute changed on your script element. You can also change the script element dynamically with JavaScript:
...
<body>
<script id="my_script" src="one.js"></script>
<button id="change_script">Change Script</button>
<script>
document.getElementById('change_script').onclick = function() {
document.getElementById('my_script').src = undefined;
var script_element = document.createElement('script');
script_element.src = 'two.js';
document.body.appendChild(script_element);
}
</script>
</body>
...
<script src="/scripts/delete-user.js.php"></script>
delete-user.js.php script would do almost exactly the same thing as your current code, except it will echo the JS instead of writing it to a file. echoing anything, though. <?php // delete-user.js.php
header( 'Content-type: application/javascript' );
echo $js;
?>