Error sending json via $ http

0

I'm trying to send a json via $ http.get, but it is returning error in console "500 (Internal Server Error)" system.technology.ws/pedited.store.asp:1 Is this error in the ASP system or in the $ http request? Follow the request code

    $http({
       method: 'GET',
       url: 'http://sistema.tecnologia.ws/pedidoGravar.asp',
       data: JSON.stringify($scope.recuperaSeuPedido),
       headers: {'Content-Type': 'application/json'}
     }).then(function successCallback(response) {
         console.log(response.data)
         console.log("enviou");
       }, function errorCallback(response) {
         console.log(response.data)
         console.log("nao enviou");
       });

I disabled the $ http and did it in pure js and returns the same error. Follow the code below

   xhr = new XMLHttpRequest();
     var url = "http://sistema.tecnologia.ws/pedidoGravar.asp";
     xhr.open("GET", url, true);
     xhr.setRequestHeader("Content-type", "application/x-www-form-urlencoded; charset=UTF-8");
     xhr.onreadystatechange = function () {
         if (xhr.readyState == 4 && xhr.status == 200) {
             console.log(xhr.responseText);
         }
         console.log(xhr.responseText);
     }
     xhr.send("json=" + encodeURIComponent(JSON.stringify($scope.recuperaSeuPedido)));
    
asked by anonymous 28.08.2016 / 14:18

1 answer

0

It was information error. Please post the code here, to help the guys that have the same problem

    $http({
     //Method alterado
     method:'POST',
     url:'http://sistema.tecnologia.ws/pedidoGravar.asp',
     //Data alterado
     data: "json=" + encodeURIComponent(JSON.stringify($scope.recuperaSeuPedido)),
     //Headers alterado
     headers: {'Content-Type': 'application/x-www-form-urlencoded; charset=UTF-8'}
  })
  .then(function successCallback(response){
        console.log(response.data)
        console.log("enviou");
  }),
  function errorCallback(response){
     console.log(response.data)
     console.log("nao enviou");
  }
    
29.08.2016 / 10:08