This repository has been archived on 2022-02-10. You can view files and clone it, but cannot push or open issues or pull requests.
titama/res/js/titama.coffee
2015-10-21 10:47:50 +02:00

35 lines
1.1 KiB
CoffeeScript

# CoffeeScript for TiTaMa
$('#remove').click ->
window.location = "./"
change_course = (id) ->
httpRequest = new XMLHttpRequest()
httpRequest.onreadystatechange = ->
if httpRequest.readyState == 4 && httpRequest.status == 200
res = httpRequest.responseText
if not res
if $('#change_id').val()
$('#noid').html("<br>Id not available.")
else
$('#noid').html("")
$('#change_name').val("")
$('#change_kind').val("")
$('#change_room').val("")
$('#change_day').val("")
$('#change_time').val("")
$('#change_prof').val("")
else
res = JSON.parse(res)
$('#noid').html("")
$('#change_name').val(res.name)
$('#change_kind').val(res.kind)
$('#change_room').val(res.room)
$('#change_day').val(res.day)
$('#change_time').val(res.time)
$('#change_prof').val(res.prof)
httpRequest.open "GET", "./res/php/get_course.php?id=" + id, true
httpRequest.send()
$('#change_id').keyup ->
arg = $('#change_id').val()
change_course(arg)