You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 

41 lines
890 B

function openLinkModal() {
$('#addLinkModal').modal('show');
}
function refreshPage() {
window.location.reload();
}
function addUrl() {
$("#link-btn").prop("disabled", true);
url = $('#link-form').val();
if (url.trim().length === 0) {
showError('URL is required');
return false;
}
$.ajax({
url: '/add',
method: 'POST',
data: { "url": url },
success: function(data) {
$('#link-form').val('');
$("#link-btn").prop("disabled", false);
if (data !== 'Error')
window.location.reload();
else
showError('URL cannot be empty');
}
});
}
function showError(error) {
$('#error-alert').text(error);
$('#error-alert').show();
}
$('#addLinkModal').on('shown.bs.modal', function () {
$('#link-form').trigger('focus');
});