implemented preview of article markdown via AJAX
This commit is contained in:
+3
-4
@@ -1,9 +1,8 @@
|
||||
// Optional: Real-time preview using JavaScript
|
||||
const textarea = document.querySelector('textarea');
|
||||
const preview = document.getElementById('preview');
|
||||
const preview = document.getElementById('md_preview');
|
||||
|
||||
textarea.addEventListener('input', function() {
|
||||
fetch('preview.php', { // Create a separate preview.php file for real-time updates
|
||||
fetch('functions/preview.php', { // Create a separate preview.php file for real-time updates
|
||||
method: 'POST',
|
||||
headers: {
|
||||
'Content-Type': 'application/x-www-form-urlencoded',
|
||||
@@ -12,6 +11,6 @@ textarea.addEventListener('input', function() {
|
||||
})
|
||||
.then(response => response.text())
|
||||
.then(data => {
|
||||
preview.innerHTML = data;
|
||||
preview.innerHTML = decodeURIComponent(data);
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user