2023-12-12 19:46:11 +00:00
|
|
|
function manipulateUrl() {
|
|
|
|
var url = $('#url').val();
|
|
|
|
|
|
|
|
$.ajax({
|
|
|
|
type: 'POST',
|
2023-12-12 20:25:41 +00:00
|
|
|
url: '../server/index.php',
|
2023-12-12 19:46:11 +00:00
|
|
|
data: { url: url },
|
|
|
|
dataType: 'json',
|
|
|
|
success: function (result) {
|
|
|
|
displayResult(result);
|
|
|
|
},
|
|
|
|
error: function (xhr, status, error) {
|
|
|
|
displayError(error);
|
|
|
|
}
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
|
|
|
function displayResult(result) {
|
|
|
|
console.log(result);
|
|
|
|
var resultContainer = $('#result-container');
|
|
|
|
resultContainer.empty();
|
|
|
|
|
|
|
|
if (result.hasOwnProperty('error')) {
|
|
|
|
resultContainer.append('<p class="error">' + result.error + '</p>');
|
|
|
|
} else {
|
|
|
|
$('#url').val(result.after.replace(/&/g, '&'));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
function displayError(error) {
|
|
|
|
var resultContainer = $('#result-container');
|
|
|
|
resultContainer.empty();
|
|
|
|
resultContainer.append('<p class="error">Error: ' + error + '</p>');
|
|
|
|
}
|
2023-12-18 15:08:52 +00:00
|
|
|
|
|
|
|
function resetSession() {
|
|
|
|
var resultContainer = $('#result-container');
|
|
|
|
var textArea = $('#url');
|
|
|
|
|
|
|
|
$.ajax({
|
|
|
|
type: 'POST',
|
2023-12-18 15:09:24 +00:00
|
|
|
url: '../server/reset_session.php',
|
2023-12-18 15:08:52 +00:00
|
|
|
success: function () {
|
|
|
|
alert('Session has been reset.');
|
2023-12-18 15:09:24 +00:00
|
|
|
resultContainer.empty();
|
|
|
|
textArea.val('');
|
2023-12-18 15:08:52 +00:00
|
|
|
},
|
|
|
|
error: function (xhr, status, error) {
|
|
|
|
console.error('Error resetting session:', error);
|
|
|
|
}
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|