update game jame
This commit is contained in:
@@ -0,0 +1,46 @@
|
||||
async function getGamejames(id = 0) {
|
||||
if(id !== 0){
|
||||
var url = "http://localhost/Game-Jaming/Backend/Controllers/GameJam/GetGameJam.php?gameJamId="+id;
|
||||
}else {
|
||||
var url = "http://localhost/Game-Jaming/Backend/Controllers/GameJam/GetGameJam.php";
|
||||
}
|
||||
let response = await axios.get(url);
|
||||
return response.data.data
|
||||
}
|
||||
async function updateGameDropdown() {
|
||||
var UGJDropDown = document.getElementById("game-jame-update-drop-down");
|
||||
var jsondata;
|
||||
var UGJDropDownHtml = "<label for='gameJamesDropdown'>vælge et game Jam:</label>"+
|
||||
"<select onchange='changeGameJamUpdate()' id='gameJamesDropdown' name='gameJamId'>";
|
||||
|
||||
await getGamejames().then((data) =>
|
||||
data.forEach(val =>
|
||||
UGJDropDownHtml += " <option value='"+val.id+"'>"+val.name+"</option>"
|
||||
));
|
||||
|
||||
UGJDropDownHtml += "</select>";
|
||||
//console.log(UGJDropDownHtml);
|
||||
UGJDropDown.innerHTML = UGJDropDownHtml;
|
||||
changeGameJamUpdate()
|
||||
|
||||
}
|
||||
|
||||
|
||||
async function changeGameJamUpdate() {
|
||||
var val = document.getElementById("gameJamesDropdown").value;
|
||||
await getGamejames(parseInt(val)).then(function (data) {
|
||||
document.getElementById("UGameJamTitle").value = data.name;
|
||||
var startDateTime = data.start_time.split(" ");
|
||||
document.getElementById("UStartDate").value = startDateTime[0];
|
||||
document.getElementById("UStartTime").value = startDateTime[1];
|
||||
var endDateTime = data.end_time.split(" ");
|
||||
document.getElementById("UEndDate").value = endDateTime[0];
|
||||
document.getElementById("UEndTime").value = endDateTime[1];
|
||||
document.getElementById("UKeyWord").value = data.key_word;
|
||||
document.getElementById("UDescription").value = data.description;
|
||||
}
|
||||
);
|
||||
}
|
||||
updateGameDropdown();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user