[Django]-Django + Angular: how to send angularjs $http data or params to django and interpret in django?

3👍

If you look at angularjs docs (https://docs.angularjs.org/api/ng/service/$http) you see that you can get params and post data like json in your case.

When you post, you’ll do something like this:

$http.post('http://www.example.com/post_data_url',
           { 'key': $scope.value }
          );

On django side, don’t add any parameter to the URL, the JSON will be inside the request, in the body to be more precise:

import json

def concord(request):
  dictionary = json.loads(request.body)
  # to use the value, access the created dictionary
  print dictionary['key']
  [...]

Leave a comment