title: http get returns error undefined
body: <p>I'm trying to do a http get to a backend function to retrive data however when i run the javascript http triggers error instead and error is undefined. I don't understand what is going wrong as i don't get any kind of error.</p>
  
  <p><strong>html</strong></p>
  
  <pre><code>&lt;body ng-app="postApp" ng-controller="postController"&gt;
      &lt;div id="container"&gt;
          &lt;div class="tab"&gt;
              &lt;div&gt;
                  &lt;p ng-show="errors"&gt;{{errors}}&lt;/p&gt;
                  &lt;p ng-show="message"&gt;Status: {{message}}&lt;/p&gt;
                  &lt;form ng-submit="startJobs()"&gt;
                      &lt;label ng-repeat="job in jobs"&gt;
                          &lt;input
                                  type="checkbox"
                                  name="selectedJobs[]"
                                  value="{{job.name}}"
                                  ng-model="job.selected"
                          &gt; {{job.name}}
                      &lt;/label&gt;
                      &lt;p/&gt;
                      &lt;input type="submit" id="startJobs" value="Start jobs" /&gt;
                  &lt;/form&gt;
              &lt;/div&gt;
  
              &lt;p ng-show="message"&gt;Status: {{status}}&lt;/p&gt;
              &lt;div&gt;
                  &lt;form ng-submit="getJobStatus()"&gt;
                      &lt;input type="submit" id="jobStatus" value="Progress" /&gt;
                  &lt;/form&gt;
              &lt;/div&gt;
          &lt;/div&gt;
      &lt;/div&gt;
  &lt;/body&gt;
  </code></pre>
  
  <p><strong>javascript</strong></p>
  
  <pre><code>&lt;script&gt;
      var postApp = angular.module('postApp', []);
      postApp.controller('postController', function($scope, $http, filterFilter) {
  
          $scope.jobs = [
              { name: 'Response status', value: 'responseStatus', selected: true },
              { name: 'test', value: 'test', selected: false }
          ];
  
          $scope.selection = [];
  
          $scope.selectedJobs = function selectedJobs() {
              return filterFilter($scope.jobs, { selected: true });
          };
  
          $scope.$watch('jobs|filter:{selected:true}', function (nv) {
              $scope.selection = nv.map(function (jobs) {
                  return jobs.name;
              });
          }, true);
  
          $scope.checkedJobs = [];
  
          $scope.user = {};
          $scope.startJobs = function() {
              angular.forEach($scope.jobs, function(value, key) {
                  if(value.selected == true) {
                      $scope.checkedJobs.push(value.value);
                  }
              });
              $http({
                  method  : 'GET',
                  url     : 'api/start_analyze/' + $scope.checkedJobs + '/',
                  data    : $scope.user,
                  headers : {'Content-Type': 'application/x-www-form-urlencoded'}
              }).success(function(data) {
                  $scope.message = data;
              }).error(function(error){
                  $scope.error = error; //here i get undefined on error.
              });
          };
          $scope.getJobStatus = function() {
              $http({
                  method  : 'GET',
                  url     : 'api/get_analyze_status/',
                  data    : $scope.user,
                  headers : {'Content-Type': 'application/x-www-form-urlencoded'}
              }).success(function(data) {
                  $scope.status = data;
              }).error(function(error){
                  $scope.error = error; //here i get undefined on error.
              });
          };
      });
  &lt;/script&gt;
  </code></pre>
  
  <p>EDIT: <strong>Error from console</strong></p>
  
  <blockquote>
    <p>Error: JSON.parse: unexpected character at line 1 column 1 of the JSON
    data
    fromJson@<a href="http://localhost:8081/bower_components/angular/angular.js:1271:9" rel="nofollow">http://localhost:8081/bower_components/angular/angular.js:1271:9</a>
    defaultHttpResponseTransform@<a href="http://localhost:8081/bower_components/angular/angular.js:9460:1" rel="nofollow">http://localhost:8081/bower_components/angular/angular.js:9460:1</a>
    transformData/&lt;@<a href="http://localhost:8081/bower_components/angular/angular.js:9551:12" rel="nofollow">http://localhost:8081/bower_components/angular/angular.js:9551:12</a>
    forEach@<a href="http://localhost:8081/bower_components/angular/angular.js:340:11" rel="nofollow">http://localhost:8081/bower_components/angular/angular.js:340:11</a>
    transformData@<a href="http://localhost:8081/bower_components/angular/angular.js:9550:3" rel="nofollow">http://localhost:8081/bower_components/angular/angular.js:9550:3</a>
    transformResponse@<a href="http://localhost:8081/bower_components/angular/angular.js:10319:21" rel="nofollow">http://localhost:8081/bower_components/angular/angular.js:10319:21</a>
    processQueue@<a href="http://localhost:8081/bower_components/angular/angular.js:14792:28" rel="nofollow">http://localhost:8081/bower_components/angular/angular.js:14792:28</a>
    scheduleProcessQueue/&lt;@<a href="http://localhost:8081/bower_components/angular/angular.js:14808:27" rel="nofollow">http://localhost:8081/bower_components/angular/angular.js:14808:27</a>
    $RootScopeProvider/this.$gethttp://localhost:8081/bower_components/angular/angular.js:16052:16
    $RootScopeProvider/this.$gethttp://localhost:8081/bower_components/angular/angular.js:15870:15
    $RootScopeProvider/this.$gethttp://localhost:8081/bower_components/angular/angular.js:16160:13
    done@<a href="http://localhost:8081/bower_components/angular/angular.js:10589:36" rel="nofollow">http://localhost:8081/bower_components/angular/angular.js:10589:36</a>
    completeRequest@<a href="http://localhost:8081/bower_components/angular/angular.js:10787:7" rel="nofollow">http://localhost:8081/bower_components/angular/angular.js:10787:7</a>
    requestLoaded@<a href="http://localhost:8081/bower_components/angular/angular.js:10728:1" rel="nofollow">http://localhost:8081/bower_components/angular/angular.js:10728:1</a></p>
    
    <p><a href="http://localhost:8081/bower_components/angular/angular.js" rel="nofollow">http://localhost:8081/bower_components/angular/angular.js</a> Line 12520</p>
  </blockquote>
  
  <p>The response from the server side is.</p>
  
  <blockquote>
    <p>status = 200 response = "Started working" headersString =
    "Content-Type: applicatio...tty(8.1.16.v20140903)\r\n" statusText =
    "OK"</p>
  </blockquote>