29 lines
891 B
JavaScript
29 lines
891 B
JavaScript
$(document).ready(function() {
|
|
// Populate select with GameJams
|
|
let JamArr = [];
|
|
|
|
axios.get('/Backend/Controllers/GameJam/GetGameJam.php').then(res => {
|
|
let resArr = res.data;
|
|
|
|
for(let i = 0; i < resArr.data.length; i++)
|
|
{
|
|
let Jam = resArr.data[i];
|
|
JamArr.push({
|
|
id: Jam.id,
|
|
Name: Jam.name
|
|
});
|
|
}
|
|
|
|
$.each(JamArr, function(i, Jam) {
|
|
console.log(`Id: ${Jam.id} \n Name: ${Jam.Name}`);
|
|
if(i === 1)
|
|
{
|
|
$('#AvailableGameJams').append('<option disabled selected value="'+ "0" + '">' + "Vælg et gamejam her" + '</option>');
|
|
}
|
|
|
|
$('#AvailableGameJams').append('<option value="'+ Jam.id + '">' + Jam.Name + '</option>');
|
|
})
|
|
}).catch(error => {
|
|
console.log(`Error: ${error}`)
|
|
});
|
|
}); |