I am trying to send both form data and a POST variable and I have no idea how to do it. I've tried to do this below:
const formthing = document.getElementById("theform");
function submitfunc(e){
e.preventDefault();
const thing = new XMLHttpRequest();
thing.open("POST", "edit.inc.php", true);
thing.onreadystatechange = function(){
if (thing.readyState == 4 && thing.status == 200){
var message = thing.responseText;
$("#theform").html(message);
}
}
var videoid = "watever";
thing.send(new FormData(formthing), "videoid="+videoid);
}
But it does not work as the php script returns "jo"
<?php
if (isset($_POST['videoid']){
}
else{
echo "jo"
}
?>
When I take a look in network it only looks like it is passing the form: what I see
If anyone has any ideas, feel free to let me know! If anything needs to be made clear, please ask.