0

Quite new to angularjs, but already done some research. I'm making the following $http post request:

       $scope.onClick2 = function () {
            var myRequest = {};
            myRequest = {};
            myRequest.ServiceType = "SearchExams";
            myRequest.SessionId = 'SessionlessRequest';
            myRequest.Compression = 'no';
            myRequest.Parameters = {};
            myRequest.Parameters.Status = ['30', '40'];
            myRequest = JSON.stringify(myRequest);
            var request = $http({
                method: 'POST',
                url: 'http://localhost/request.php',
                data: 'data=' + myRequest,
                headers: {'Content-Type': 'application/x-www-form-urlencoded'},
            })
        };

My request.php handles the request and sends back an json response. Howerver I see in the response tab of chrome and in fiddler that the original request is also in the response. See below:

Array
(
[data] => {"ServiceType":"SearchExams","SessionId":"SessionlessRequest","Compression":"no","Parameters":{"Status":["30","40"]}}
)
{"Error":false,"ErrorMessage":null,"Data":[{"ExamID":1,"A.......

I would expect only the last line ({"Error":false,"ErrorMessage":null,"Data":[{"ExamID":1,"A...... to be returned....looking at what my request.php send back it should.

Am I missing something?

Thanks,

5
  • And where is your PHP code? We cant tell from your JS why PHP is returning something different Commented Jan 19, 2016 at 13:46
  • This part is from my PHP code, Logger::LogDebug("response: $response"); And this part is in the logging.: 2016-01-19 14:44:09 - DEBUG --> [::1][] [Request] response: {"Error":false,"ErrorMessage":null,"Data":[{"ExamID":1,"..... Commented Jan 19, 2016 at 13:57
  • 1
    Remove logging obviously, print_r or whatever you are using in controller Commented Jan 19, 2016 at 13:57
  • Sorry dfsq, I don't understand what you are asking for. Commented Jan 19, 2016 at 14:24
  • Sorry guys, already fixed it myself, I indeed had an error in my php code. Commented Jan 19, 2016 at 14:33

1 Answer 1

0

Sorry for waisting anybodies time on this. There was an error in my php code indeed.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.