31 lines
659 B
JavaScript
31 lines
659 B
JavaScript
$(document).ready(function() {
|
|
|
|
$('#email_template_selection').change(function(e) {
|
|
e.preventDefault();
|
|
if ($(this).val() == 0) {
|
|
$('#subject').val('');
|
|
$('#message').val('');
|
|
}
|
|
else {
|
|
jqxhr = $.ajax({
|
|
'url' : './index.php?admin_modul=admin_object_edit&action=get_data&object=Email_template&object_id=' + $(this).val(),
|
|
'dataType' : 'JSON',
|
|
'type' : 'GET'
|
|
});
|
|
jqxhr.success(function(data) {
|
|
if (data.name) {
|
|
$('#subject').val(data.subject);
|
|
$('#message').val(data.body);
|
|
} else {
|
|
alert('Error!');
|
|
}
|
|
});
|
|
jqxhr.error(function() {
|
|
alert("ERROR: can't load url");
|
|
});
|
|
}
|
|
});
|
|
|
|
|
|
|
|
}); |