title: Django submit form without page refresh
body: <p>I'm using <strong>Django-Angular</strong> and trying to <strong>post a form</strong> and obtain data in back-end..I'm able to achieve this but found that the <strong>page is reloading</strong> while saving the form. How can we achieve the same without page render?</p>
  
  <p>forms.py</p>
  
  <pre><code>def home(request):
      if 'application/json' in request.META['CONTENT_TYPE']:
          print 'hi'
          print request.body
  
      return render(request, 'home.html', {})
  </code></pre>
  
  <p>home.html</p>
  
  <pre><code>&lt;form name="indexForm" ng-submit="submitForm()"&gt;
  
      &lt;div class="form-group"&gt;
          &lt;label&gt;File Path&lt;/label&gt;
          &lt;input type="text" name="path" class="form-control" ng-model="file.path"&gt;
      &lt;/div&gt;
      &lt;div class="form-group"&gt;
          &lt;label&gt;File Name&lt;/label&gt;
          &lt;input type="text" name="file_name" class="form-control" ng-model="file.file_name"&gt;
      &lt;/div&gt;
      &lt;div class="form-group"&gt;
          &lt;label&gt;ext&lt;/label&gt;
          &lt;input type="text" name="ext" class="form-control" ng-model="file.ext"&gt;
      &lt;/div&gt;
      &lt;button type="submit" class="btn btn-primary"&gt;Submit&lt;/button&gt;
  
  &lt;/form&gt;
  </code></pre>
  
  <p>script</p>
  
  <pre><code>$scope.submitForm = function() {
      console.log('from submit')
      $http({
          url: 'http://127.0.0.1:8000/',
          data: $scope.file,
          method: 'POST',
          headers: {
              'X-CSRFToken': $cookies['csrftoken']}
      })
      }
  </code></pre>
  
  <p>Please let me know code above is <strong>correct way of posting data</strong>? How can we <strong>post data</strong> from angular to backend(django) <strong>without page refresh</strong></p>
  
  <p>Thanks in advance...Any help is much appreciated</p>