aboutsummaryrefslogtreecommitdiff
path: root/scripts/src/note-edit.js
diff options
context:
space:
mode:
Diffstat (limited to 'scripts/src/note-edit.js')
-rw-r--r--scripts/src/note-edit.js8
1 files changed, 5 insertions, 3 deletions
diff --git a/scripts/src/note-edit.js b/scripts/src/note-edit.js
index 3d01794..390b93d 100644
--- a/scripts/src/note-edit.js
+++ b/scripts/src/note-edit.js
@@ -75,6 +75,8 @@ function edit_note(btn, form, title, quill, qcontainer, url){
var modal = modalBox(saveModal);
document.getElementById('close-btn').classList.add('hide');
//send the request to the REST API
+ console.log(request);
+ console.log(form);
request.send(new FormData(form));
}
title.setAttribute('contenteditable', false);
@@ -99,7 +101,8 @@ function notebookCreate(form) {
request.open('POST', url);
var csrftoken = getCookie('csrftoken');
request.setRequestHeader('X-CSRFToken', csrftoken);
- request.setRequestHeader('HTTP_X_REQUESTED_WITH', 'XMLHttpRequest');
+ request.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
+ request.setRequestHeader("X-Requested-With", "XMLHttpRequest");
request.onload = function() {
if (request.status >= 200 && request.status < 400) {
var data = JSON.parse(request.responseText);
@@ -161,9 +164,8 @@ if (typeof(document.getElementById('note-edit-form')) != 'undefined' && document
e.preventDefault();
edit_note(e.target, form, title, quill, qcontainer, window.location.href );
}, false);
- var notebook_form = document.getElementById('nb-create-form');
- initColorPicker(notebook_form);
var notebookAddForm = document.getElementById('nb-create-form');
+ initColorPicker(notebookAddForm);
ajaxHijack(notebookAddForm, notebookCreate)
var create_notebook_btn = document.getElementById('add_id_notebook');
addHandler(create_notebook_btn);