remove trailing spaces
add csrfmiddlewretoken to the ajax request