Game-Jaming/Frontend/Javascript/AddGameJam.js

28 lines
1.0 KiB
JavaScript

$(document).ready(function () {
axios.defaults.baseURL = "http://localhost/Game-Jaming";
$("#createGameJam").submit(function (e) {
let URL = "/Backend/Controllers/GameJam/NewGameJam.php";
const params = new URLSearchParams();
params.append("newGameJam", document.getElementById("indsend").value);
params.append("gameJamName", document.getElementById("gamejamTitle").value);
params.append("startDate", document.getElementById("startDate").value);
params.append("endDate", document.getElementById("endDate").value);
params.append("startTime", document.getElementById("startTime").value);
params.append("endTime", document.getElementById("endTime").value);
params.append("keyWord", document.getElementById("keyWord").value);
params.append("description", document.getElementById("Beskrivelse").value);
axios
.post(URL, params)
.then(function (response) {
console.log(response);
})
.catch(function (error) {
console.log(error);
});
e.preventDefault();
});
});