Game-Jaming/Frontend/Javascript/AddGameJam.js

32 lines
890 B
JavaScript
Raw Normal View History

$(document).ready(function() {
$('#createGameJam').submit(function(e) {
let URL = 'https://ptsv2.com/t/tzztn-1616799712/post';
let form = $('#createGameJam')[0];
let formData = new FormData(form);
let id = $('#indsend').attr('name');
let value = $('#indsend').val();
let startTime = $("#startTime").text();
let endTime = $("#endTime").text();
formData.append(id, value);
formData.set('startTime', startTime);
formData.append('endTime', endTime);
axios.post(URL, formData, {
header: 'multipart/form-data'
}).then(res => {
if (res.status === 200)
{
console.log('New Game Jam Created!');
}
}).catch(error => {
console.log(error.response);
});
e.preventDefault();
});
});