Game-Jaming/Frontend/Javascript/AddGameJam.js

28 lines
1.0 KiB
JavaScript
Raw Permalink Normal View History

2021-04-21 08:51:18 +00:00
$(document).ready(function () {
axios.defaults.baseURL = "http://localhost/Game-Jaming";
2021-04-21 08:51:18 +00:00
$("#createGameJam").submit(function (e) {
let URL = "/Backend/Controllers/GameJam/NewGameJam.php";
2021-04-26 09:16:37 +00:00
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);
2021-04-21 08:51:18 +00:00
axios
2021-04-26 09:16:37 +00:00
.post(URL, params)
.then(function (response) {
console.log(response);
2021-04-21 08:51:18 +00:00
})
2021-04-26 09:16:37 +00:00
.catch(function (error) {
console.log(error);
2021-04-21 08:51:18 +00:00
});
e.preventDefault();
});
});