Create a gist now

Instantly share code, notes, and snippets.

What would you like to do?
$("#eigyo").click(() => {
callAjax('eigyo');
});
$("#soumu").click(() => {
callAjax('soumu');
});
$("#keiri").click(() => {
callAjax('keiri');
});
$("#dev").click(() => {
callAjax('dev');
});
const callAjax = (value) => {
// 画面にメッセージを表示
const btnObj = {
'eigyo':'営業',
'soumu':'総務',
'keiri':'経理',
'dev':'開発'
}
$('#msg').text(btnObj[value] + 'に送信します。');
setTimeout(() => {
$('#msg').text('');
},3000);
// 送信
$.ajax({
type: "POST",
url: "http://localhost:8080/",
data: {value},
dataType: "json"
})
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment