Skip to content

Instantly share code, notes, and snippets.

@Hemanthkumar2112
Forked from gerhc/django POST
Created August 10, 2021 08:49
Show Gist options
  • Save Hemanthkumar2112/068833b1af1b5493ad077a9db3445c3c to your computer and use it in GitHub Desktop.
Save Hemanthkumar2112/068833b1af1b5493ad077a9db3445c3c to your computer and use it in GitHub Desktop.
AJAX POST
xhr = new XMLHttpRequest();
xhr.open("POST", "add_specs/", false);
xhr.setRequestHeader("Cache-Control", "no-cache");
xhr.setRequestHeader("X-Requested-With", "XMLHttpRequest");
xhr.setRequestHeader("X-CSRFToken", getCookie('csrftoken'));
data = JSON.stringify(spec_rows);
xhr.send(data);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment