• Skip to primary navigation
  • Skip to main content
  • Skip to footer

JH Tech Services

A knowledgebase

  • Portfolio
  • Knowledgebase
  • About

Using AngularJS $http.post service with php server requires adjustment

April 14, 2014 by jer0dh

Created a php program that speaks to a mySQL database and returns json. My angular app can then use the $http service to communicate with the server. I had it working when using GET $http.get(), but as soon as I changed it to $http.post() and changed the php program to use $_POST as well, it stopped working.

Turns out php need the request formatted in a particular way. So I found the following article that goes in depth on the issue and after adding the angular “hook” it shows, everything started working again.

link to $http.post and php fix

  • JavaScript
  • Knowledgebase

Footer

  • Portfolio
  • Knowledgebase
  • About

© 2023