Closed magicbeanman closed 4 years ago
I also use fetch to save the data and I manually append the value of the of the editor to the form data like this: formData.append('content', mde.value());
Oh ok I did not know that is how you can get the form's value with easyMDE.value()
It looks like I can work with that pretty well, thank you
How do you save with javascript ajax? I have noticed the textarea that this is set does not update, there's some eventlistener to send it or something (not sure how that works)
anyway my code I have to click the save button twice for it to actually POST the new data, the POST request it sends the first time does not have the new data, but the second time it does have the data. It is easyMDE that causes this. All I want to do is be able to click a save button and not have it refresh the entire page to save, so whatever method there is to do that I will use.. as I said my current one works but I gotta click save 2 times. (no jquery please)
method="POST" onsubmit="event.preventDefault(); saveNotesForm(event,this);">
function saveNotesForm(e,form) { var formData = new FormData(form); fetch(form.action,{ method:'POST', body: formData, }); console.log('sent msg'); }