notebook/app/assets/javascripts/generators.js
Euan Kemp ef480f22d2 move .js.js files -> .js
.js.coffee made more sense I guess; simplify down the extension to the
expected one.
2020-09-18 20:09:42 -07:00

42 lines
980 B
JavaScript

$(document).ready(function() {
// Character name generator
$('.character_name_generator').click(function() {
const target = $(this).closest('.row').find('input[type=text]');
$.ajax({
dataType: 'text',
url: '/generate/character/name',
success(data) {
target.val(data);
}
});
return 0;
});
// Character age generator
$('.character_age_generator').click(function() {
const target = $(this).closest('.row').find('input[type=text]');
$.ajax({
dataType: 'text',
url: '/generate/character/age',
success(data) {
target.val(data);
}
});
return 0;
});
// Location name generator
$('.location_name_generator').click(function() {
const target = $(this).closest('.row').find('input[type=text]');
$.ajax({
dataType: 'text',
url: '/generate/location/name',
success(data) {
target.val(data);
}
});
return 0;
});
});