Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- parsed_json = json.loads(request.body)
- $("#add_user_button").click(function (event) {
- event.preventDefault();
- $.ajax({
- type: "POST",
- url: '/user/',
- data:
- {
- 'action': "addUser",
- 'username': $('#id_username').val(),
- 'password': $('#id_password').val(),
- 'groups': $('#id_groups').val()
- }
- ,
- contentType: 'application/json; charset=utf-8',
- processData: false,
- });
- }
- print(request.POST.get("username"))
- #print(request.encoding) #returns none
- print("Request body is :")
- print(request.body)
- print(type(request.body))
- hello
- Request body is :
- b'username=hello&password=world&csrfmiddlewaretoken=&addUser=Add+User'
- <class 'bytes'>
Add Comment
Please, Sign In to add comment