diff options
author | luxagraf <sng@luxagraf.net> | 2019-01-09 13:29:17 -0600 |
---|---|---|
committer | luxagraf <sng@luxagraf.net> | 2019-01-09 13:29:17 -0600 |
commit | be0bb4e123240ac3ce02431b974c82f8f05d843b (patch) | |
tree | e2da7ac44be955ad5cbf32c0a35dc507ba63e844 /scripts/src/note-edit.js | |
parent | d5f430d3e1e2b274d8d8f744251e8b6b4b72ebd9 (diff) |
latest changes
Diffstat (limited to 'scripts/src/note-edit.js')
-rw-r--r-- | scripts/src/note-edit.js | 8 |
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); |